Quote:
Originally Posted by turtle
|
Kind of sort of.
That's pretty cringey to watch, but yeah I imagine there really are some folks out there who are
exactly that awkward.
For the most part, Python doesn't care whether you use tabs or spaces, but it
does need for you to
pick a lane. A given file should be indented exclusively by
one or the other, never mixing both, because one programmer's definition of a tabstop width may be completely different from the next programmer's (1 tab = 4 spaces? 8? 2???), and Python doesn't want to pick sides in that argument. Instead, it basically throws up its arms and makes
you correct the inconsistency.
Most editors and IDEs, even vim in the terminal, can be taught to insert the right amount of space characters when you hit the tab key. I'm pretty sure 99% of my indended spaces in recent years originated from me hitting the tab key and trusting my editor to do the right thing.
("The right thing" is "convert to spaces", obviously.
)
Quote:
Originally Posted by turtle
I'm certainly looking to get better with Python but not really trying to make it a day Job thing for me. I like a good general knowledge enough to be able to modify someone else's code for my personal uses. This means I don't have to learn everything and can typically get the results I'm after. […] In fact, this is how most of my "coding" gets done that isn't bash scripting. I actually am pretty good with bash so I have that going for me.
|
No better time than the present to learn more Python!
I've been using Python professionally for about ten years now across different kinds of projects, but it's also been my go-to tool for lots of one-off scripts and simple projects at home. Usually my thinking goes: Can I solve this by piping a bunch of commands together like grep | cut | sort | uniq? If not, then can I solve it using a shell script with simple variables and loops and conditions? If not, Python!