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

Jim Jewett jimjjewett at gmail.com
Fri Jun 17 17:59:01 CEST 2011


On Fri, Jun 17, 2011 at 12:39 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Fri, Jun 17, 2011 at 3:15 AM, Jan Kaliszewski <zuo at chopin.edu.pl> wrote:
>> or even (to stress that it is a language syntax construct:

>>    @inject mem=collections.Counter(), MAX_MEM=1000
>>    def do_and_remember(val, verbose=False):

> While that would require the from__future__ dance to make "inject" a
> new keyword, I like it much better than the
> looks-like-a-decorator-but-isn't syntax.

This is reminding me of the once (or final or static) discussion a few
years ago, but I can't seem to find that PEP.

-jJ



More information about the Python-ideas mailing list