18 ms·
So I imagine you have that perspective because you started less than 20 years ago. In some ways the idea of the Pythonic Way to do things evolved in opposition
by rout39574 3y ago
So I imagine you have that perspective because you started less than 20 years ago. In some ways the idea of the Pythonic Way to do things evolved in opposition to Perl's vigorous advocacy of More Than One Way.
Python has been really winning for some time, so it's natural that its ideological discipline has grown ragged. The crop of kids who value options above consistency don't have the scars of the Perl age to inform their prejudices.
But Python is -dramatically- better focused, as a community, on finding a Pythonic way to proceed, and then advocating it, than previous cultures.
- kbenson 3y ago> But Python is -dramatically- better focused, as a community, on finding a Pythonic way to proceed, and then advocating it, than previous cultures. I would revise that to be that the pythonic culture of one acceptable way to to is better matched with a lot of good development practices. Perl was also very good at finding a Perl way to proceed. It's just that with Perl that often mean a lot of implicitness and "do what I mean", and multiple ways to do it so you could fit it within your preferred style and tailor it to the current project's needs. That all sounds good until you are confronted with the flip side of the coin, which is that it's harder to understand when looking at something written with those perspectives for the first time or after a long hiatus from the project, which puts a lot of importance on policy and coding standards which saps effort from just getting something done. I love Perl, and it's still the language I write most often for work, and it's no great mystery why Python became preferred.
- gabereiser 3y agoNot just practices, tooling. The whole typing system. Linting to check for mistakes. For the love of black.
- KptMarchewa 3y agoPython's static typing still feels very very clunky and bolted on, and tooling around it was rather bad, like mypy. In general I definitely wouldn't say python tooling was good. It's improving rapidly with ruff tho, just as JavaScript when esbuild appeared.
- mardifoufs 3y agoDumb question: I know the built-in typing (import typing) is limited in some ways, but it works pretty fine to cover most basic needs. So what does mypy add? I'm super interested in adding typing to some code we have but I'm just a bit confused by the choices available. Would mypy with pydantic be a good combination or do they overlap?
- woodruffw 3y agoThe two are complementary: the built-in `typing` module only provides type annotations, not type checking. Mypy provides the latter, via the type annotations that you (and others) add to Python codebases. Pydantic overlaps with mypy in the sense that it provides a mypy plugin, but otherwise it's just like any other Python library.
- mardifoufs 3y agoSo mypy runs "at run time"? I guess that makes sense, I thought the annotations provided some form of checking too, but now I realize that I should really spend some time to inform myself better :').
- stableviper 3y agoNo, it's more that pydantic runs "at run time" while mypy not.
- woodruffw 3y agoSort of -- mypy is its own standalone program, and you run it to typecheck your program's type annotations. It does some evaluation of the Python program (specifically imports and some very basic conditional evaluation, among other things), but it never really executes the codebase itself.
- gabereiser 3y agoMypy runs as a type linter/checker. See https://mypy-lang.org/ https://mypy-lang.org/
- bmitc 3y agoIsn't Python's tooling usually considered some of the worst?
- gabereiser 3y agoBy what standard? Yours? Java developers? Rust developers? The fact that Python has typing now, tools to check those, and has plenty of tooling around “make it faster”, I think your world view might be stuck in 2010. Python has gone from a slow obscure scripting language to a powerhouse. Conda, NumPy, Scikit, PyTorch, GPU programming, Games, Analytics, web apps, API’s, I think it’s safe to say this ain’t your grandpa’s Python anymore.
- bmitc 3y agoI have seen Python in action since 2010 plenty of times, including the present. It's been a mess every time. My worldview is driven by F# and Elixir, namely the `dotnet` and `mix` tooling, respectively. So no, Python's tooling does not impress me in the slightest. The first thing you need to do is get agreement on all the different checkers, linters, formatters. For Elixir, there's one tool for each task. My worldview feels quite current. Those other things you mentioned aren't relevant to tooling. They're distributions, libraries, and applications. But note that Conda's existence was basically due to the fact of Python's tooling being poor.
- gabereiser 3y agoYou see tooling in a different view than typical Python users. Python users see things like iPython, notebooks, the ability to quickly do statistics and plot results, as tooling - to do their jobs. Data Science. Machine learning. Things that perplex and confound static-typing OOP purists. So yes, by your world view - Python is a mess. There's no one way to do things, there's no one tool, no one linter, no one formatter. I praise the fact that there isn't. What a boring world. What choice would you have if that tool didn't satisfy your needs? Find another language? I began in that world view. The C/C++/Java/DotNet everything must have a standard, a fixation on a singular consensus. That's not how things work in the open source world of Python, javascript, rust, etc. Will there be gravitation towards a paradigm? sure, until such time that a new one emerges. If you looked at Python in the 2.5 days and looked at Python today - You cannot argue the tooling has gotten better.
- cutler 3y agoBut Ruby took all the best bits of Perl so I'm still perplexed as to why Python "won".
- 2colours 3y agoTaking a look at the bigger picture, it does indeed seem like the Perl philosophy lost to the Python philosophy overall. Looking at the hip n cool languages, not just Python for scripting but surely Go and to some extent Rust as well for native stuff (Dart for scripting also but it didn't outright "win"), these are mostly languages that deliberately simplified things. Yes, even Rust - it needs to be compared to C++ and its biggest feature is basically that it doesn't let you do all the things C++ does, within a very similar model. The only language that I heard is going against these trends (but I'm largely clueless what it's actually like) is Julia which sort of has its own "lay" niche like Perl did back in the day, and is mostly winning based on the premise that it's a performant scientific language. The industry obsesses over costs of adoption, stability, maintenance; in short: how to get the most out of the least actual new development. It does make quite a lot of sense, to be honest, although sometimes it's really demotivating at an individual level. And frankly, "learn the language, duh" usually comes up when the language is complex or unintuitive for no practical purpose. Of course there will be people who always complain if they have to learn anything but I don't think they make the majority, or even a significant minority, in the software engineering world. "Learning the language" is only as much of a virtue as the language itself serves its purpose, which includes easy of use and the readability of someone else's code.
- bb88 3y agoRuby did have a lot going for it about 15 years ago. Many Java/JSP people jumped ship and got on the ruby train. Ruby was a breath of fresh air comparatively. Python had a great community though, and the Python Software Foundation went out of it's way to make people feel accepted in the community. And frankly programming is often more of a social activity than most people realize -- particularly for new programmers. So new programmers tended to lean towards python, because the resources to lean on others were there. And people like Raymond Hettinger, Naomi Ceder, Ned Batchelder, and Yarko Tymurciak were approachable even if the BDFL wasn't.
- vonwoodson 3y ago+1 for mentioning that python's original competitor was Perl. This point is forgotten some 20-30 years latter
- bb88 3y agoNot just perl, but C/C++/Java as well. Ruby was a competitor to Java JSP development back in the day. And I remember when a lot of Java people jumped ship to Ruby. I moved from C++ to python over a decade ago and never looked back. Back then, the python jobs were scarce -- but based upon how I picked up the language, many of the typical C++ issues just disappeared -- and I knew it was going to become popular. One comp sci professor talking at a PyCon years ago made a point that maybe the best college level introductory course probably should not have been SICP based but Python. His example was that for the first time in 5 years of teaching intro courses he had people coming up to him looking to change majors.
- cutler 3y agoMIT dropping SICP/Scheme for Python conicided with the general decline of education as an end in itself. Python is the VHS of computer languages. I couldn't believe it when I heard MIT dropped a language renowned for its elegant lambda implemenation in favour of a language in which lambdas were not only frowned upon but literally throttled. I think it says everything that MIT ditched Scheme and SICP at the same time as it would be near impossible to teach SICP with Python.
- bb88 3y agoI would argue that Python is the Betamax of computer languages, and C++ is the true VHS. Fight me. But seriously, Python is good. Don't let the perfect be the enemy of good, only computer science people can do this.
- GeorgeTirebiter 3y agoI suggest you read the reasons that MIT switched: https://www.wisdomandwonder.com/link/2110/why-mit-switched-from-scheme-to-python https://www.wisdomandwonder.com/link/2110/why-mit-switched-f... and https://www.johndcook.com/blog/2009/03/26/mit-replaces-scheme-with-python https://www.johndcook.com/blog/2009/03/26/mit-replaces-schem... and https://vimeo.com/151465912#t=3577s https://vimeo.com/151465912#t=3577s As to being 'near impossible' to teach SICP with Python: https://web.archive.org/web/20210916151732/https://doc-04-5g-docs.googleusercontent.com/docs/securesc/fovekt30vpsg00ila08qg5tnqs1of1fl/r4ufoc04kejj7q5dpk5j9v46iibo57od/1631805450000/03893712795242147733/12805020624557113431Z/1nln2g0CB9I0KkaG73twpB66TRjF2_On8?nonce=p2oc0mq7olp90&user=12805020624557113431Z&hash=8nurqvid310jrp4q4pljrbtoihdeogk9 https://web.archive.org/web/20210916151732/https://doc-04-5g...
- mdbauman 3y agoBack when I decided it was time to add a scripting language, Perl and Python seemed like the obvious choices, and in my mind were equally good options. I asked my best friend which I should choose, and he more or less said, "You can't go wrong with either one, but when you ask for help Perl people are assholes and Python people are nice." I can't confirm his thoughts on Perl and I haven't interacted much with Ruby, but the Python community is definitely welcoming and patient in my experience. I wouldn't be surprised if this was a significant factor in Python's prevalence over Perl, Ruby, or anything else.
- stevage 3y agoOh I have met Ruby people and it's a big factor in why I never learnt the language.
- cutler 3y agoI can't imagine Python's welcoming community has anything to do with it. If anything it was Ruby that had a reputation for being the most welcoming community with its MINASWAN (cringe) philosophy.
- woodruffw 3y agoI'm genuinely curious: what's "cringe" about MINASWAN? (I write mostly Python these days, but have been involved in both communities for a long time, and MINASWAN never particularly stood out to me other than as a cute reminder to be nice.)
- cutler 3y agoIt was meant tongue in cheek as I was defending Ruby being the most welcoming community. It's just a bit twee like the voice-over on London Underground - "See it, say it, sorted".
- kaycey2022 3y agoThere is no problem with someone being nice. It's only a problem when they want you to be nice exactly like them.
- endgame 3y agoI disagree: Python seems to have a zillion build tools and multiple competing type-checkers.
- sharts 3y agoI think Python has some of the worst API documentation I’ve ever read. Even Java puts it to shame and that is sad
- kiwijamo 3y agoComing to Python from PHP it was interesting to see that in the PHP world I'd get 80% of my knowledge from the PHP documentation and 20% elsewhere. In the Python world it's easily the other way around. It also doesn't help that the PHP documentation is more up to date so I am using the most current info, while for Python their own docs are so bad I rely on other docs but they all vary on what version of Python it depends on and whether it follows current best practice. The difference is night and day and one of the reason I ended up going back to PHP.
- g8oz 3y agoYeah the PHP documentation is extremely pragmatic and seems designed to get you going quickly with useful examples. The Python documentation seems to be suffering from some sort of weird snobbery. Very wordy as another comment mentioned. Examples are frequently lacking or inadequate. They seem like they're trying to compete with MSDN in "professionalism" although these days even the MSDN examples are better. There is an entire ecosystem of python tutorial websites around the web that would not exist if the documentation was as helpful as that of PHP.
- frou_dh 3y agoThe stdlib documentation definitely has a unique flavour. I would characterise it as "wordy".
- lukeck 3y ago> There should be one-- and preferably only one --obvious way to do it. I just wish Python applied this approach to package management. It is needlessly complicated.
- Doxin 3y agoThe obvious part is definitely lacking, but the long and short of it is basically to ignore all the newfangled solutions. They are much more trouble than they are worth. Just use pip with a venv and a requirements.txt (easier) or a pyproject.toml (cleaner). I really fail to see what the newer tools actually bring to the table. From my experience they solve no actual problems and just introduce more bugs and weird behavior.