[Python-ideas] 'Injecting' objects as function-local constants

Jan Kaliszewski zuo at chopin.edu.pl
Thu Jun 16 23:45:08 CEST 2011


Alex Light dixit (2011-06-16, 13:21):

> my best guess is that to implement this we would need to slightly
> redefine the way that python looks up variables by making it look in a
> special 'injected' dictionay after looking through locals and before
> globals.

But one of the default-argument-hack reasons is to optimize variable
access by avoid dictionary loopup (locals are not dictionary-based).

I'd rather stick to the implementation sketch described by Nick
(changing the syntax a bit; as I said, imho @keyword... should be placed
before function def).

Cheers.
*j




More information about the Python-ideas mailing list