Thanks for the bug report - this is fixed for the next release (the actual 
problem here is we were looking for instance members for special methods, which 
we shouldn't do).  You can actually get the fix now if you get the latest bits 
from IronPython on http://www.codeplex.com, but we should have a release real 
soon now.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Foord
Sent: Friday, June 16, 2006 8:03 AM
To: Discussion of IronPython
Subject: [IronPython] Overloading __getattr__

Hello all,

We have a problem with IronPython and overloading __getattr__, and use of the 
python magic methods (double underscore).

To illustrate the problem :

class Test(object):
    def __getattr__(self, name):
        print name
        raise AttributeError("Go Away")

if Test():
    print "Hello"

On CPython it does this :

Hello

On IronPython :

__nonzero__
Traceback (most recent call last):
  File C:\Personal\Python Projects\modules in progress\ironpython\test.py, line 
6, in Initialize
  File C:\Personal\Python Projects\modules in progress\ironpython\test.py, line 
4, in __getattr__
AttributeError: Go Away

We are trying to overload __getattr__ and getting calls to __hash__, __len__, 
__gt__ etc sent there in various places.

All the best,

Michael Foord
http://www.resolversystems.com


_______________________________________________
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

Reply via email to