[IronPython] Problem with super

Dino Viehland dinov at exchange.microsoft.com
Fri Jul 13 21:21:38 CEST 2007


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: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20070713/f2d37dc6/attachment.html>


More information about the Ironpython-users mailing list