7 ms·
Python 3.9
- pizza234 6y agoDoes anybody have interesting, practical, examples of the consequences of switching to a PEG parser? I think this is a rather innovative choice among the mainstream languages?
- xrisk 6y agoTake a look at the PEP - https://www.python.org/dev/peps/pep-0617/ https://www.python.org/dev/peps/pep-0617/
- pizza234 6y agoI'm aware of that, but I was curious about real-world effects (the PEP is mostly theoretical).
- coldtea 6y agoThe real world effects, aside from a little slower parsing speed iirc, would only be noticed by the compiler / parser writers. Mainly making it easier to do syntax extensions... For Python devs there will be no real-world effects...
- pansa2 6y ago> Mainly making it easier to do syntax extensions... Yes, AFAICT the main reason for the parser change is to enable the pattern matching feature [0] that’s likely coming in 3.10. [0] https://www.python.org/dev/peps/pep-0634/ https://www.python.org/dev/peps/pep-0634/
- wjakob 6y agoCaution: if you rely on pybind11 or a project using pybind11 (many projects do, like NumPy/SciPy/Tensorflow/PyTorch..), hold off on upgrading to Python 3.9.0 for now. A change in Python 3.9.0 introduces undefined behavior in combination with pybind11 (rarely occurring crashes, but could be arbitrarily bad). We will work around it in an upcoming version of pybind11, and Python will separately also fix this problem in 3.9.1 slated for release in December. Details available here: https://pybind11.readthedocs.io/en/latest https://pybind11.readthedocs.io/en/latest and https://github.com/python/cpython/pull/22670 https://github.com/python/cpython/pull/22670.
- user5994461 6y agoI was about to ask why would they do a release if they know it's broken and blowing up their flagship libraries? It's worrying when the interpreter starts to favor shipping quickly over being functional. But nevermind, the 3.9 release was 15 days ago and the bug was identified 8 days ago. I guess there has to be a release before people will start using it and find bugs/regressions. There's a saying to always wait for the .1 release, this is a good illustration of why.
- raziel2p 6y agoWhat makes pybind a "flagship library"? If it was very widely used this bug probably would've been caught by people testing the alpha/beta/rc versions of 3.9.
- nemetroid 6y ago> If it was very widely used this bug probably would've been caught As the top-level comment says, it rarely causes crashes.
- true_religion 6y agoPeople using numpy are not in the fringe. If this wasn’t triaged during prereleases then it’s either that it doesn’t always cause problems, or there is an issue in the diversity of testers.
- teilo 6y agoDupe. 3.9 came out on 10/5 Discussion here: https://news.ycombinator.com/item?id=24691565 https://news.ycombinator.com/item?id=24691565
- kumarvvr 6y agoYup. My bad. I saw it in a tweet and thought it released today. Sorry.
- xrisk 6y agoI’m curious if anyone knows why they didn’t use Antlr for the new parser. My (limited) experience using it has been nothing short of fantastic.
- pansa2 6y agoApparently they didn’t even consider it: “We did not seriously consider alternative ways to implement the new parser, but here's a brief discussion of LALR(1). [...] Other variants of LR were not considered, nor was LL (e.g. ANTLR).” [https://www.python.org/dev/peps/pep-0617/ https://www.python.org/dev/peps/pep-0617/]
- xrisk 6y agoYes, that sentence is what prompted my question :D
- pansa2 6y agoSounds like the thought process was along the lines of: “LL(1) makes it too hard to add complex new features to the language, we must change to something else; PEG is something else; therefore we must change to PEG”.
- lgauss 6y agoAlso, the PEG parser's inability to point out unintended ambiguities fits well into the general anti-formalism of Python.
- pansa2 6y agoIt’s interesting that the old parser had the same problem. Although it did the parsing using an LL(1) algorithm, it never actually verified that the grammar was LL(1) before doing so. [https://discuss.python.org/t/should-there-be-a-check-whether-grammar-is-ll-1/5192 https://discuss.python.org/t/should-there-be-a-check-whether...]
- 6y ago
- scionthefly 6y agoIt's clearly time to EOL Python 3 and start using Python 4.
- deleted 6y ago[deleted]
- Areading314 6y agoThe annual release cadence is a disaster for Python. I've already run into countless interpreter compatibility issues where new code has to run in a different environment. 3.6, 3.7, 3.8, and now 3.9 are all still officially supported, which just adds a huge mental burden when reading python code, because you have to remember when each feature was released.
- swalsh 6y agoI still have code that relies on 2.7.... yes, i'm ashamed of myself :(
- raziel2p 6y agoHow does it add burden when reading code? Writing code, sure, but only when you don't research the environment you're going to be deploying into. Unless you started working with Python like last year you probably remember when new useful features were released, and for stuff you haven't used before, the Python documentation always tells you when it was added.
- Areading314 6y agoSay your production environment runs on python 3.7. New developer on the team opens a pr and you see dataclasses, a class attribute type hint, maybe a walrus operator and some required keyword-only args. They say they've tested the code in their local virtual environment and it runs. Which of these features break the build and which are the new best practices? Sure ci will catch most of these but maintaining 100% code coverage is a significant burden and very rare in practice.
- hkjhakjsdf 6y agoIf your new developer installs a higher version than you are running in production, the issue is with your on boarding process, not python release cadence.
- Areading314 6y ago
- ampdepolymerase 6y ago"RUSTPROOF STRINGS"
- mikewarot 6y agoWhy do they keep breaking things? Don't they understand code doesn't get maintained at this rate in the real world? You write the code, and it should just keep working, like infrastructure. It's only when you have water gushing out of the ground that you worry about a water main... not because some plumbing supply company decided that certain types of plumbing suddenly don't work. Things should last for lifetimes before they break, not 12 months.
- bromonkey 6y agoInfrastructure doesn't "run for a lifetime" without the proper upkeep and regular maintenance... just like code. There is no set and forget in technology, just because you are doing the infrastructure work doesn't mean someone in the company isn't.