A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-March/071506.html below:

[Python-Dev] locals(), closures, and IronPython...

[Python-Dev] locals(), closures, and IronPython... [Python-Dev] locals(), closures, and IronPython...Dino Viehland dinov at exchange.microsoft.com
Mon Mar 5 22:26:19 CET 2007
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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20070305/9d9e617c/attachment.html 
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4