Super works w/ new-style classes so if you change it to:

class A(object):
    def Foo(self):
         pass

class B(A):
    def Foo(self):
        super(B, self).Foo()

B().Foo()

It'll work.  CPython behaves the same way:

Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class A:
...     def Foo(self):
...          pass
...
>>> class B(A):
...     def Foo(self):
...         super(B, self).Foo()
...
>>> B().Foo()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in Foo
TypeError: super() argument 1 must be type, not classobj
>>>

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anders M. 
Mikkelsen
Sent: Thursday, July 12, 2007 1:03 AM
To: Discussion of IronPython
Subject: [IronPython] Problem with super

Hi

I have some problems getting 'super' working with IronPython.
Running the following simple script:

 class A:
     def Foo(self):
         pass

 class B(A):
     def Foo(self):
         super(B, self).Foo()

 B().Foo()
yields:

 TypeError: expected type, got classobj

Any ideas?


/anders
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to