[Python-ideas] non-Pre-PEP: Syntactic replacement of built-in typeswith user-defined callables (Take 2... fewer newlines!)

Terry Reedy tjreedy at udel.edu
Wed Jan 30 04:01:57 CET 2008


"Taro" <taroso at gmail.com> wrote in message 
news:fefcdfb70801272201y10d57ebdo39d559ca5bc6e8a2 at mail.gmail.com...

| Theoretical Performance Differences:  Since a typedef is purely
| syntactic sugar, and all tranformational work would be done at
| compilation,

I think this is a key issue which, unfortunately, I believe, works against 
your proposal.  If the alternative constructor is a builtin C function, 
then yes, the transformation could be done at compile time.  But I think 
this much more difficult for one written in Python.  As far as I know, the 
byte-code interpreter is not normally running during compilation.  From 
__future__ imports work precisely because they are not really imports.  But 
alternate constructor imports would have to be.  I don't know enough, 
though, to know if this could be made to work.

tjr








More information about the Python-ideas mailing list