3 ms·
I find that to be a really odd choice when OTOH tabs/indents are required for block structure.
by tannhaeuser 6y ago
I find that to be a really odd choice when OTOH tabs/indents are required for block structure.
- RHSeeger 6y agoPython: Semantic whitespace is the one true way Also Python: Meh, you can leave out the whitespace, I'll figure it out
- notacoward 6y agoSimilarly, Python is supposed to be a language that's easy to learn and easy to read code in. Pythonistas take pride in that, as IMO they should. With that in mind, preserving a counterintuitive behavior that exists solely because of how the lexer was implemented seems inconsistent at best. A language with a more relaxed attitude toward inscrutable brevity - e.g. Perl - can use that excuse. I don't think Python should.
- mywittyname 6y agoI first learned Python in the 2.6 days, and have been developing in it fairly regularly over the 15 or so years since. I've never encountered this issue before. The reason I've never encountered this issue, or even needed to know it was an issue is because I use good development tools. 1) Pycharm highlighted the or in orange, making it clear that it was being interpreted as a keyword, 2) I use a linter (as we all should) which explicitly highlights the lack of whitespace around the token as an issue (PEP 8: E225), and 3) I use a code formatter (which we all should) which, again, highlights this statement as requests that I fix it. Python has a lot of flaws. This one is down near the bottom of ones that are even really worth talking about.
- notacoward 6y agoStarted with 1.5 myself. I've never encountered this issue, nor would I expect to. It might be down near the bottom of the list, but it's still a wart and it showed up here for us to talk about. You seemed to think it was worth talking about at even greater length than I did. So do you just believe it's not worth other people expressing opinions?
- mywittyname 6y agoThis showed up on the front page because it's a novelty that even people who have been using the language for over a decade would never encounter. You're taking my statement way too personally and out of context. You and everyone else can express your opinions all you want. As a topic in the list of "flaws with Python," I don't think it's a very important or insightful topic because it's not something people really run into. This just doesn't fit there. This is a novelty, pure and simple. Filed under "weird programming hacks you won't expect" This would be fine. It's like, `([]+![])[+!+[]+!+[]+!+[]][([]+{})]` in javascript. Weird, kind of interesting, but it's not really a "flaw," at least not the sense of something that will burn you unexpectedly.