[Python-3000] [Python-ideas] Namespaces are one honking great idea -- let's do more of those!

Ron Adam rrr at ronadam.com
Sun Feb 3 02:38:27 CET 2008



Christian Heimes wrote:
> Stephen J. Turnbull wrote:
>> Mac OS X's open command does something according to extension:
>>
>> chibi:tmp steve$ echo 'print "hello, world"' >> hello.py
>> chibi:tmp steve$ python hello.py 
>> hello, world
>> chibi:tmp steve$ open hello.py 
>> chibi:tmp steve$ 
>>
>> I don't know what, though.  The disk spun, I waited a second, and then
>> the prompt returned. :-)
> 
> I don't know how Mac OS X's open wrapper works. It should open the same
> program as finder does when you clock on a file.
> 
>> How about a wrapper which (like the Unix shells) starts the
>> interpreter from the file named in the shebang if any, and provide a
>> tool for updating shebangs conveniently (for the user) and
>> automatically (for installers).
>>
>> Of course you need to make sure that this wrapper doesn't use any
>> Python 3000 features.<wink>
> 
> I'm not interested in writing a replacement for the shebang magic. It
> may lead to more problems than it's worth the additional work. The
> wrapper must be implemented in C.
> 
> Christian


Instead of a shebang which depends on the shell, maybe a version specifier 
of some sort could be used?

    # -*- pyversions: 2.5, 2.6 -*-

So if a python 3.x detects a too low a version, maybe it can try to restart 
the program with the highest installed version specified.  (Or some 
variation of this.)

Ron



More information about the Python-3000 mailing list