PyCon: Evangelizing Python
PyCon: Evangelizing Python
Posted Apr 5, 2013 4:16 UTC (Fri) by welinder (guest, #4699)In reply to: PyCon: Evangelizing Python by smurf
Parent article: PyCon: Evangelizing Python
That's actually wrong.
When a tab sneaks in you so get to make those mistakes and there is
nothing that visually tells you anything. Things line up neatly,
but don't actually work.
In C you don't get to make those mistakes. If it's important
then you can see it.
Posted Apr 5, 2013 6:19 UTC (Fri)
by smurf (subscriber, #17840)
[Link] (2 responses)
The Python community has more-or-less agreed on the second option; personally I strongly prefer the third. But that's as much bikeshedding as whether a C open brace goes on the same line as the if statement, or below it (and if so, which indent does it get?)
This kind of mistake (mixing up tabs and spaces) is so easy to check for that Python actually has an option for it. Which C compiler checks for "wrong" indentation on nested statements?
Posted Apr 5, 2013 7:02 UTC (Fri)
by dlang (guest, #313)
[Link] (1 responses)
If you are a full-time programmer who works in a nice, dedicated environment, you may end up with a nice tailored config.
But, like most sysadmins, I have to support software on all sorts of systems, many of which I haven't ever touched 5 minutes before I'm working on the code.
by the way, this is why I'm a vi person. every system has some variation of vi that I can run to get the job done. other editors, it's not the same thing.
Posted Apr 8, 2013 21:08 UTC (Mon)
by wtanksleyjr (subscriber, #74601)
[Link]
That's why I stopped trying to learn APL, by the way. So I do agree with your basic concern.
But it's really not accurate to say that Python requires an editor with a specific configuration. I have to edit Python with Notepad from time to time, and nothing breaks. It's simply a matter of comfort and caution to use an editor that won't make it easy to do things that screw up code -- but the language doesn't care.
So many times I have to edit code that a hardware engineer or a skilled, dedicated sysadmin (who isn't a double-classed programmer-sysadmin like I am) has previously modified. Very commonly I'll find random indentation (hardware engineers are the worst -- I recall cases where every newly added line of C was added flush left, no indentation at all, in the middle of properly indented code; and then no attempt was made to bring the result back upstream).
It's a minor thing to note that Python CAN be told to error out if the indentation is mixed in any way; by default it only errors out if the indentation is completely ambiguous, or if it contains spaces before tabs on the same line.
> But, like most sysadmins, I have to support software on all sorts of systems, many of which I haven't ever touched 5 minutes before I'm working on the code.
Same here. And I'll also say that Python is usually not the first choice of sysadmins -- Perl is usually much closer to a sysadmin's basic toolbox, and much much further away from a programmer's, while Python makes all the sysadmin tools take more typing to use.
> by the way, this is why I'm a vi person. every system has some variation of vi that I can run to get the job done. other editors, it's not the same thing.
Hahahaha. You work with SANE systems. Healthy systems. I work with systems where sometimes the only choice is vi, and sometimes the only choice is notepad.exe.
Anyhow, if you can't install your editor, you can't install a language. You're stuck with what you've got. In my case, I switch between bash, powershell, and cmd.exe. If I took your complaint seriously, I would have to hate using powershell and bash because they aren't available on all the platforms. Naw... Better to simply and silently resent the corporate choices that made the better choice unavailable.
We're stuck with the corporate tools we're given. (Pun intended but unindented.)
(BTW -- I'm a vi guy too, given the chance.)
-Wm
Posted Apr 5, 2013 8:42 UTC (Fri)
by intgr (guest, #39733)
[Link]
Note that this is fixed in Python 3, it gives you a "TabError: inconsistent use of tabs and spaces in indentation"
PyCon: Evangelizing Python
Or tell your editor to not use tabs at all. Again, simple.
Or tell your editor not to use spaces (i.e. ony Python indent == 1 tab) and make the tabs wide enough that you can't miss any misalignment.
PyCon: Evangelizing Python
PyCon: Evangelizing Python
PyCon: Evangelizing Python
