5 ms·
To be frank I think the python community lacks self-awareness. There's this ritual you have to do when learning python: blindly accept status-quo design choice
by bdg 6y ago
To be frank I think the python community lacks self-awareness.
There's this ritual you have to do when learning python: blindly accept status-quo design choices as "universally good" (but call it "pythonic"), and crap on other languages. Never admit python or the ecosystem has issues or shortcomings, and if another language has something better than yours (eg, Yarn, or Composer is way better than anything in Python (poetry is a good step but not a competitor)), or offer really good IoC tools: just double-down on the status-quo and say something like "looks over engineered, I see no reason why I would need that".
Pythonic is putting a decorator everywhere, coupling the system together into a ball of mud where you can't decouple it. Pythonic is having annoying mixed naming conventions. Why do I need methods to have underscores in 2021, but classes to use camel case? Why do my lines of code need to fit on a punched card invented decades before the language was invented? Why does the idiomatic "one true way" need to be what some other engineer thinks is "the one true" way?
Python is a fractal of closed-mindedness and single-use code. There's a reason it took a decade to get projects onto python 3, but PHP can swiftly move the entire ecosystem from v5 to v7 in a year. FastAPI is getting a lot of praise recently, but frameworks of this style are a dime-a-dozen in other languages and have been around for a decade.
Pythonic is a meaningless word that just gives firepower to the most confident-sounding engineer in a company to shoot down anyone who doesn't code like them. It's not an objective concept, it's innovation poison.
- AyrtonB 6y ago> However, know when to be inconsistent -- sometimes style guide recommendations just aren't applicable. When in doubt, use your best judgment. Look at other examples and decide what looks best.
- bdg 6y agoMy issue is with the behaviour of humans who belong to this hegemonic cult, not the document.
- czardoz 6y ago> Why do I need methods to have underscores in 2021, but classes to use camel case? Why do my lines of code need to fit on a punched card invented decades before the language was invented? Why does the idiomatic "one true way" need to be what some other engineer thinks is "the one true" way? These problems are applicable to all languages, not just Python.
- afarrell 6y agoTo rephrase: Different engineers and different problems have different needs. When you ignore this, you'll get something that someone new can pick up, read the docs, and work with... but you can end up with a slight mismatch between tool, task, and user. In some contexts, that slight mismatch can escalate to become quite wide. A deeper examination of Django would yield rich examples of this. ------------ The above is really a message for myself as an engineer who loves python and has an emotionally visceral distaste for PHP. I offer it to y'all in case you also find it useful insight.
- FridgeSeal 6y agoPython: where relying on “lol magic” is acceptable thing to have in production code. At least “magic” in languages like Haskell has the dignity to be backed up by a type system with more consistency than a wet noodle. Python can’t seem to decide whether it wants to be a production grade language or easy-for-beginners and keeps implementing pointless features (looking at you walrus operator and weird version or pattern matching) instead of fixing its actual problems like the tire-fire that is packaging and performance. “But Python has never been about performance” someone will say, and that’s fine, but it’s increasingly becoming a language that isn’t any more ergonomic to use than its peers, with worse packaging and deployment, useful tools (type hunting) that the community seemingly refuses to adopt widespread and its slower on top of all that? Why would you actually bother?
- PartiallyTyped 6y ago> But Python has never been about performance I have been burnt by this. As much as I like python's "expressiveness" so to speak, it is too slow for my needs; the ML community gravitated towards that because it is simple to implement and test large models because C++/C/Cuda are doing the lifting. However, in my flavour/field of ML, python is often the bottleneck because the sampling/simulations are glued with it and the need to sample 10s of millions of steps ends up with possibly billions of function calls in python.
- dunefox 6y agoYou might take a look at Julia with PyCall and RCall, if you haven't already. I find it solves a lot of headaches I have with Python while allowing me to leverage the ecosystem.
- PartiallyTyped 6y agoYes, I am currently learning Julia. My issue with it is that the documentation is rather sparse or lacking, but I am getting the hang of it. On the positive side, it appears that the jitter works quite well and fast arrays as first class citizens make me happy.
- porker 6y ago> There's a reason it took a decade to get projects onto python 3, but PHP can swiftly move the entire ecosystem from v5 to v7 in a year. PHP did well with v5 to v7. It took more than a year but your point is well made. The PHP v7 to v8 move is not as easy [1, 2, 3]. Not having Python 2 to 3 fresh in everyone's minds is one reason; not having failed PHP v6 is another. The breakages that led to the downfall of PHP6 made backwards compatibility a focus in PHP7. Since PHP7 was released the contributors/voices who favour backwards compatibility have left or been drowned out. The emphasis on supporting legacy code has gone. [1] https://stitcher.io/blog/new-in-php-8#breaking-changes https://stitcher.io/blog/new-in-php-8#breaking-changes [2] https://24daysindecember.net/2020/12/21/a-perfect-storm/ https://24daysindecember.net/2020/12/21/a-perfect-storm/ (recommended reading) [3] https://developer.yoast.com/blog/the-2020-wordpress-and-php-8-compatibility-report/ https://developer.yoast.com/blog/the-2020-wordpress-and-php-...
- chimprich 6y agoTo take one of your complaints: > Why do my lines of code need to fit on a punched card invented decades before the language was invented? Keeping lines short helps keep information density high, allows you to fit more views of the code on screen without wrapping, and encourages use of intermediary variables to keep complexity per line low. This isn't a Python issue. Any decent style guide will have a maximum line length. > Python is a fractal of closed-mindedness I don't know what you mean by a "fractal" of closed-mindedness, but you seem very certain of your opinions and not very open-minded.
- michaelcampbell 6y agoLine length isn't a python issue. A line length of 80, is. (Thus the punch card reference). My stint in python made me appreciate A line length more, but 80 got to be absurd.
- CivBase 6y agoWhat does a line length of 80 have to do with punch cards? My understanding is that 80 was originally chosen because that was the standard number of columns on a terminal. It has been continued to be used because it happens to be roughly just under half the width of a typical 16:9 or 16:10 monitor at normal font sizes, making it ideal for window snapping and side-by-side diffs. I have to review code in other languages all the time which follow a style guide that defines a maximum line length of 120 or 160. It's a huge pain having to scroll left and right all the time. But I'm not about to replace my perfectly good 16:10 monitors with ultrawides.
- bdg 6y agoIt's actually 79 chars. > the standard number of columns on a terminal are inherited from punched cards. https://stackoverflow.com/a/4651037/257493 https://stackoverflow.com/a/4651037/257493 But in 2021 I can resize my TTY Emulator, we have better fonts, and screen proportions have changed. A column length of 80 is in the ancestral DNA of computers because it was the number that packed nicely onto a sheet of paper. That paper was that size because it fit nicely into a paper portfolio and filing cabinet. The portfolio was that size because it was a reasonably big-enough sheet to adjust the paper cutter to. 80 has nothing to do with humans reading code. It's all post-hoc justifications and fairy tales. The whole thing is a 200 year old legacy system bug.
- detaro 6y agoTo me this sounds like a big straw man of a "the python community" that does not exist in that form. Things like the packaging system being shortcomings is widely acknowledged, I've very rarely encountered people being dogmatic about "pythonic" code, especially when it just comes to style guide. You've encountered one or two, and are extrapolating to an entire community about that.
- michaelcampbell 6y agoYou berate someone for limiting his post to his context and do the exact same thing yourself. > I've very rarely encountered people being dogmatic about "pythonic" code, Followed by... > You've encountered one or two, and are extrapolating to an entire community about that. I'll have to say my experience in "the community" has been far closer to his experiences than your equally small bubble.
- LockAndLol 6y agoWhatever language you're using, someone hates. Just be aware of that. There is no perfect language that fits every situation and there is no perfect community. Know your needs and which language fits your needs.
- michaelcampbell 6y agoI can't disagree. With one exception, that being Raymond Hettinger, it's to the point of cringiness when someone says "pythonic". The last 2 years of my last job was 99% python, and the smug, "we love what we did and nothing else" attitude I think you've exactly captured. I know this is not universal, but I've seen it online a lot, and lived it for far too long.