Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
subclassing a module: misleading(?) error message
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Erik Johnson, post: 2052208"] I ran into a problem I didn't understand at first. I got part of it figured out. Let me first demonstrate the original problem: class Super(object): def __init__(self): self._class = 'Super' def hello(self): print "%s says 'Hello'" % self._class import Super class Sub(Super): def __init__(self): self._class = 'Sub' Python 2.3.4 (#1, Feb 7 2005, 15:50:45) [GCC 3.3.4 (pre 3.3.5 20040809)] on linux2 Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last): File "<stdin>", line 1, in ? File "Sub.py", line 4, in ? class Sub(Super): TypeError: function takes at most 2 arguments (3 given) My question is NOT "What's wrong here?" (The answer to that is that the import in Sub.py should be: from Super import Super i.e., I tried to use the module itself where I meant to subclass the class defined in that module). My questions are: Why does python complain about a function here? (it's a class definition statement, right?) Is there really a function being called here? If so: What function was called? What two arguments is it expecting? What three were given? Thanks, -ej [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
subclassing a module: misleading(?) error message
Top