3 ms·
Python syntax is predictable, readable and concise. What else do you need?
by aspyct 4y ago
Python syntax is predictable, readable and concise. What else do you need?
- koito17 4y agoThat is not my experience having to deal with a Python codebase for the first time in my life recently. I do not enjoy attempting to understand the magical annotations everywhere, the terse, cryptic syntax of list comprehensions, random syntax trivia like array[::-1], tons of line noise in regular expressions, having to __format__ "private" symbols like this, and so on. I obviously don't have experience with Python, but the only good thing about the syntax to my eyes is the vertical space savings you gain by doing away with curly braces.
- dragonwriter 4y ago> having to __format__ “private” symbols like this, But…that’s not how you format “private” symbols in Python, conventionally; single leading underscore is; double leading is for identifiers you want mangled with classnames, and double leading and trailing is for special methods.
- Yoric 4y agoIn my book, special methods (aka protocols) are... well, let's say not the most beautiful part of Python. Lot's of poorly documented magic in there.
- TylerE 4y agoPython does not have private symbols. __foo__ is just convention
- ARandomerDude 4y agoConventions that strong might as well be mandatory — at least if you are a decent coworker.
- mkl 4y agoMagical annotations? Do you mean decorators? Or maybe types? Whether they're present at all depends on the code base, and most probably have neither. [i*i for i in range(10)] is hardly terse or cryptic. Python regular expressions are much like regular expressions anywhere else, so you're not really criticising Python there. You might need extra backslashes if you were trying to do them without raw strings (r'\s*' == '\\s*'), but that's hardly unique to Python either.
- Yoric 4y agoI've worked professionally in Python and I find decorators quite magic, indeed. For better and for worse.
- Hendrikto 4y ago> random syntax trivia like array[::-1] That‘s not random syntax trivia. It‘s a slice. Pretty generic and straighforward.