[ python-Bugs-933068 ] Different behaviour using super() and explicit base class.

SourceForge.net noreply at sourceforge.net
Mon May 10 05:52:14 EDT 2004


Bugs item #933068, was opened at 2004-04-11 13:59
Message generated for change (Comment added) made by ncoghlan
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=933068&group_id=5470

Category: Threads
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Lawrence Allan Jones (lajones)
Assigned to: Nobody/Anonymous (nobody)
Summary: Different behaviour using super() and explicit base class.

Initial Comment:
I created a child class of threading.Thread. To invoke 
the parent __init__ method, I called super(C, 
self).__init__().

When called at run-time, Python threw an assertion 
exception informing me that the group parameter must 
be None. (The detailed error message was assert group 
is None, "group argument must be None for now".) I had 
not changed this parameter.

I created a similar class and explicitly called 
threading.Thread.__init__(). This call did not exhibit the 
fault at run-time.


----------------------------------------------------------------------

Comment By: Nick Coghlan (ncoghlan)
Date: 2004-05-10 19:52

Message:
Logged In: YES 
user_id=1038590

This looks like a usage problem to me - the call to 
super() returns an already bound method object, hence 
'self' does not need to be supplied as an argument to the 
__init__ call. 
 
That is, the correct call to fix the 'Broken' class is: 
 
super(Broken, self).__init__() 
 
 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=933068&group_id=5470



More information about the Python-bugs-list mailing list