[IronPython] locals() usage

Gary Stephenson garys at ihug.com.au
Sat Aug 19 10:19:10 CEST 2006

I discovered in my playing that ipy allows the following use (abuse?) of 

def test2( dic, nm ):
    dic[nm] = 5

def test()
    x = 10
    test2( locals(), "x" )
    print x  # prints 5 in ipy and 10 in CPython 2.4


My question is, is this by design?  Can it be relied upon, or will the 
behaviour be changed to match CPython?  Personally, I would really like it 
to remain as is, as it enables some features that I need, but I understand 
the motivation for matching CPython wherever possible.

(Keep up the great work, IronPython is superb.)

many tias,


More information about the Ironpython-users mailing list