[IronPython] setattr and module

Dino Viehland dinov at exchange.microsoft.com
Fri Nov 2 18:08:08 CET 2007


Thanks for the report Seo, I'll fix this for a future release (I don't think it'll make it in time for the next one).  The problem here is that we're not currently using DynamicSite's for the setattr built-in function.  Instead we go to a runtime call in PythonOps which is going to attempt to do this via interfaces and DynamicType's.  That's actually not the correct way to set attributes anymore as it doesn't work x-lang (or w/ the member access operators that are defined on ScriptModule).  Luckily get/delete were switched over a while ago so those just work.


-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo
Sent: Friday, November 02, 2007 7:57 AM
To: Discussion of IronPython
Subject: [IronPython] setattr and module

# x.py
# empty

# test.py
import x
setattr(x, 'a', 1)
print x.a

AttributeError: 'module' object has no attribute 'a'

--
Seo Sanghyeon
_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list