3 ms·
> Perl has version tags in source code and everything is feature gated including the stdlib. Python does none of that. from __future__ import annotations >
by simonw 1y ago
> Perl has version tags in source code and everything is feature gated including the stdlib. Python does none of that.
from __future__ import annotations
> just looking at source code gives you no indication if you can run it with your installed python version
requires-python = ">=3.9"
- mdaniel 1y agoI don't believe that "from __future__" is the future-proofing you think it is, they just named it that way to be cute - a hypothetical 3.19 version couldn't even use it, since it's just a normal python import $ python3.13 -c 'from __future__ import awesome_feature' File "<string>", line 1 SyntaxError: future feature awesome_feature is not defined the very idea of "future feature is not defined" is insaneo Anyway, I'd guess what they intend is try: from __future__ import fever_dream except SyntaxError: fever_dream = None because python really gets off on conditional imports
- simonw 1y agoI was responding to the "Python does none of that" by pointing out that Python does indeed have features to help introduce new capabilities in a thoughtful way - I know it's not the same thing as something like conditional imports.
- chromatic 1y agoI prefer Perl's approach for both: use v5.40; .... That's explicit, tied to a specific version, and executable code which can be scoped to a single source file. (I'd argued for that feature for years with my `Modern::Perl` feature bundle; glad to see that can be deprecated now.)
- musicale 1y agoNot sure that >= is going to age well.