def a():
x = 4
y = 2
def b():
print y, locals()
print locals()
b()
a()
in CPython prints:
{'y': 2, 'x': 4, 'b': <function b at 0x020726F0>}
2 {'y': 2}
I'm wondering if it's intentional that these don't print dictionaries w/ the
same contents or if it's more an accident of the implementation. In other
words would it be reasonable for IronPython to promote all of the locals of a
into b's dictionary when both a and b call locals?
We currently match CPython's behavior here - at least in what we display
although possibly not in the lifetimes of objects. We're considering an
internal change which might alter the behavior here though and end up
displaying all the members.
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com