Can Python learn from Perl? Perl 5 can now run Perl 6 code

Chris Angelico rosuav at gmail.com
Thu Jul 28 03:48:38 EDT 2016


On Thu, Jul 28, 2016 at 5:21 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Perl 5.24 is now 100% forwards compatible with Perl 6.
>
> The Perl community is agreed that Perl 6 is, in fact, a completely different
> language than Perl 5. Unlike Python 3 which differs only in a few minor (but
> important) ways from Python 2, Perl 6 is a significant break from the past,
> enough to justify calling it a different language and not just a backwards-
> incompatible version change. And yet Perl 5 now can run Perl 6 scripts.
>
>
> Well, kinda sorta. I'm not really pulling your leg. But Perl has a feature that
> if you tell it to run a file with a hashbang line, it will call the given
> executable to run that file. That's now been improved to recognise Perl6 as an
> external executable, instead of trying to run it as Perl 5 code.
>
> https://metacpan.org/pod/distribution/perl/pod/perldelta.pod#Hashbang-redirection-to-Perl-6
>
>
> Should Python do something similar? At least for Python 2/3 code?

Sounds something like the py.exe launcher on Windows. So I guess what
you're asking is: should the 'python' binary on other platforms do the
same kind of checks?

The answer to that probably should take into account virtual
environments, but it would be convenient for some specific
circumstances. I wouldn't recommend depending on it, though, if for no
reason than that you can't guarantee that 2.7.13+ is installed on
everyone's systems.

ChrisA



More information about the Python-list mailing list