4 ms·
I always strongly discourage the use of things like this construct in any language. A language is meant to be read not just written. A non-expert python progra
by gejjaxxita 12y ago
I always strongly discourage the use of things like this construct in any language.
A language is meant to be read not just written. A non-expert python programmer who encounters this will be confused.
- solox3 12y agoThere will always be non-expert programmers of many languages. Avoiding language-specific constructs will not solve the issue. As far as portability is concerned (if you port software by hand a lot, for example), this is indeed an issue; but if you work with people who write python code, you might as well use everything in your toolbox.
- pyre 12y ago> There will always be non-expert programmers of many languages. Avoiding language-specific constructs will not solve the issue. This is a language-specific issue that occurs rarely in the wild. Yes, it's part of the language, but it's used rarely enough that it can trip up even experienced Python programmers. For example, Perl (until more recently) allowed one to change arrays to be 1-indexed, rather than 0-indexed at runtime. Just because it's part of the language doesn't mean that it's a good thing to use it.
- collyw 12y agoAs someone who did years of Perl (and that's not the most intuitive of languages), I was really confused when I first saw this in Python.
- est 12y ago> who encounters this will be confused And get it after 30 seconds doc reading?
- andrewchambers 12y agoIn my opinion it's just poorly named.
- collyw 12y agoAfter 2 hours of searching to find the appropriate piece of documentation. I encountered this situation. I assumed the else belonged to an if, but the indentation rules were somehow being broken. What would you expect me to look up in the docs?