I always thought I was the only person who had that problem using the Python REPL, I find it incredibly annoying but all the Python users around me never seem bothered by it.
Posted Mar 30, 2013 12:25 UTC (Sat) by thoeme (subscriber, #2871)
[Link]
Puh! And I thought *I* was only one being put off by python's use of identation... It always reminds of my miserable time in university using some retarded pascal interpreter on the school's VAX system. I tried to learn Python, but stopped imedeately when I found out that first example would not work due to 2 <tab>s in a block identation. Stupid design choice.
PyCon: Evangelizing Python
Posted Mar 30, 2013 17:58 UTC (Sat) by jwakely (subscriber, #60262)
[Link]
I have no problem at all with the indentation in a source file, but I wish the REPL was a bit smarter about handling the variations in whitespace that easily occur when selecting and pasting chunks of code.
PyCon: Evangelizing Python
Posted Mar 30, 2013 18:44 UTC (Sat) by smurf (subscriber, #17840)
[Link]
Why should Python's indentation be a problem?
You use indentation in pretty much every other high-level programming language, otherwise you won't understand your code tomorrow. The only difference is that Python uses the indents directly, while most other languages require redundant clutter like braces or BEGIN-END keywords to tell the compiler what to do.
Related to this, about everybody I know has written (or debugged) at least one piece of interesting C code like
if (foo)
if (bar)
baz();
else
quux();
You simply don't get to make these mistakes in Python.
Interestingly, the idea of indentation as primary syntax seems to spread to other contexts.
Cf. CoffeeScript or HAML.
PyCon: Evangelizing Python
Posted Apr 5, 2013 4:16 UTC (Fri) by welinder (guest, #4699)
[Link]
> You simply don't get to make these mistakes in 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.
PyCon: Evangelizing Python
Posted Apr 5, 2013 6:19 UTC (Fri) by smurf (subscriber, #17840)
[Link]
So set up your editor that your tabs actually do the same thing, visually, that Python thinks they do logically. Simple.
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.
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?
PyCon: Evangelizing Python
Posted Apr 5, 2013 7:02 UTC (Fri) by dlang (✭ supporter ✭, #313)
[Link]
any language that requires me to have a specific configuration in my editor to use the language is not a reasonable choice.
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.
PyCon: Evangelizing Python
Posted Apr 5, 2013 8:42 UTC (Fri) by intgr (subscriber, #39733)
[Link]
> there is nothing that visually tells you anything
Note that this is fixed in Python 3, it gives you a "TabError: inconsistent use of tabs and spaces in indentation"