Thanks for a fun bug, Michael, just to clarify, this is using the IronPython 1.1 release, correct?
If it is of any consolation, this is the output from the IronPython 2.0 alpha where this no longer happens: IronPython console: IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> class X(object): ... p2 = property(lambda self: 3) ... >>> dir(X) ['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', 'p2'] Martin -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Foord Sent: Friday, June 01, 2007 8:06 AM To: Discussion of IronPython Subject: [IronPython] Lambdas, properties and namespace leakage Hello all, Another fun one. If you use 'property' to wrap a lambda in a class namespace then an extra name leaks into the class namespace (which confused our documentation system). CPython: >>> class X(object): ... p2 = property(lambda self: 34) ... >>> dir(X) ['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash_ _', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr_ _', '__setattr__', '__str__', '__weakref__', 'p2'] Amongst all the detritus you can see 'p2' nestled there at the end. IronPython: >>> class X(object): ... p2 = property(lambda self: 34) ... >>> dir(X) ['<lambda$0>', '__class__', '__dict__', '__doc__', '__init__', '__module__', '__ new__', '__reduce__', '__reduce_ex__', '__repr__', '__weakref__', 'p2'] See the weird first entry! Shouldn't be there... Thanks Michael -- Michael Foord Resolver Systems [EMAIL PROTECTED] Office address: 17a Clerkenwell Road, London EC1M 5RD, UK Registered address: 843 Finchley Road, London NW11 8NA, UK Resolver Systems Limited is registered in England and Wales as company number 5467329. VAT No. GB 893 5643 79 _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
