Python 2.4: Why only assignments to None are forbiden?

Bengt Richter bokr at oz.net
Mon Nov 15 09:11:17 CET 2004


On Mon, 15 Nov 2004 00:35:12 -0600, Ian Bicking <ianb at colorstudy.com> wrote:

>Bengt Richter wrote:
>> Since this is a compile-time issue , perhaps it is time to consider
>> a pragma statement as a framework for telling python pre-runtime things
>> like optimization info? E.g., pragma could send in-context meta-info
>> to various python infrastructure components using python method call syntax
>> which the compiler could recognize in the token stream and compile and
>> execute in its working environment right then. So e.g.,
>> 
>>     pragma compiler.override(len=True, cmp=False)
>
>There's a recipe for doing something very similar to this with the 
>current Python:
>
>http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/277940
>
Yes, that's a nice clever decorator thing for certain kinds of optimization
(by Raymond Hettinger), but if file='something' were disallowed, and you
wanted to do it in a function, I don't think a decorator would get
control early enough to do anything about it, even if there were a hook
for unlocking the bindability of file. But yes, in general, I can see why you
were reminded ;-)

Regards,
Bengt Richter



More information about the Python-list mailing list