5 ms·
Counterpoint: I've been programming in Python in a web development context for almost a decade now and I don't think I've been bitten by any of these ever (at l
by Nextgrid 4y ago
Counterpoint: I've been programming in Python in a web development context for almost a decade now and I don't think I've been bitten by any of these ever (at least not strongly enough to remember), and been involved in many large-scale projects with many developers and we had no issues.
The "worst" that I can remember was actually a Django quirk - ORM result sets (or QuerySets as they call them) execute their query at object evaluation time rather than at instantiation, so unless you cast your resultset to a list it won't actually talk to the DB just yet. Now attach a GUI debugger such as PyCharm/IntelliJ - it will internally evaluate every expression immediately (to populate its GUI) and cause the behavior to diverge (it will "fix" the code and behave as you'd expect when ran under the debugger).
I guess there could be certain contexts (system programming? low-level libraries? etc) where these are going to be an issue but when it comes to web/API or business logic development I haven't encountered these.
- praptak 4y agoI agree in that it's not these quirks that are the problem with Python. My take on Python is that it has poor support for tools that make it easy(-ier) to reason about code that you don't know very well. "Where is this called from?", "Where is x being set/modified/read?" - such questions are hard to answer with a large Python code base and I'm not even talking of code that abuses the dynamic nature of Python.
- franga2000 4y agoAlthough this didn't used to be the case just a few years ago, with modern tools and a well-type-hinted libraries, most of the browsing and refactoring functions I was used to from the Java world are available in Python. But yes, the moment someone tries to be too clever (metaclasses, dynamic *kwargs parsing...), all of that falls apart and you're back to reading the docs.
- gonzo41 4y agoI don't love python, but I generally think if you color between the lines and don't try to be too clever then you'll usually end up fine and not hit any clangers. However, I do think that the pythonic way leads people to write terse clever code that's needlessly more complex.
- Woden501 4y agoI imagine that many of these aren't common ones to run into with a team that comes from many languages other than Python or that has people with enough experience to know that realize these kids of unclear, apparently inconsistent coding practices are not a good idea in code you want to be maintainable a year or more from now. The glance I took at a few of them shows me the smack of syntatic sugar that is all aesthetics without any real performance benefit thus provide no real benefit beyond maybe saving a few keystrokes. Keystrokes are cheap, days spent by a junior dev trying to find a bug in a pile of syntatic sugar filled Python is not.
- Izkata 4y agoMutable default arguments is the one I see most likely to come up regularly, it's gotten us a few times: https://github.com/satwikkansal/wtfpython#-beware-of-default-mutable-arguments https://github.com/satwikkansal/wtfpython#-beware-of-default...