zlacker

[parent] [thread] 4 comments
1. simonw+(OP)[view] [source] 2025-08-04 14:17:26
> 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"
replies(3): >>mdanie+g7 >>chroma+Hg >>musica+vn2
2. mdanie+g7[view] [source] 2025-08-04 14:48:01
>>simonw+(OP)
I 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
replies(1): >>simonw+D8
◧◩
3. simonw+D8[view] [source] [discussion] 2025-08-04 14:54:09
>>mdanie+g7
I 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.
4. chroma+Hg[view] [source] 2025-08-04 15:26:43
>>simonw+(OP)
I 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.)

5. musica+vn2[view] [source] 2025-08-05 07:30:07
>>simonw+(OP)
Not sure that >= is going to age well.
[go to top]