On Class namespaces, calling methods
vsoler
vicente.soler at gmail.com
Sat Apr 10 11:01:55 EDT 2010
On Apr 10, 4:46 pm, Duncan Booth <duncan.bo... at invalid.invalid> wrote:
> vsoler <vicente.so... at gmail.com> wrote:
> > I get the following error message:
>
> > TypeError: m() takes no arguments (1 given)
>
> > Since I have not created any instances of Uno, there is no self
> > object, and I do not understand what object is supplied to the
> > function call.
>
> > Could anybody explain what argument is being supplied to the method?
> > Is ther any workaround to call the m function?
>
> Which version of Python are you using? Python 2.6 gives:
>
> TypeError: unbound method m() must be called with Uno instance as first
> argument (got nothing instead)
>
> whereas Python 3.1 gives:
>
> >>> Uno.m()
>
> mouse
>
> (assuming you change the print statement to work on Python 3.x)
Hello Duncan,
I am using ver 2.6, under PythonWin
The feedback that I get from python is exactly this one:
>>> print Uno.a
1
>>> Uno.m()
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
TypeError: m() takes no arguments (1 given)
>>>
More information about the Python-list
mailing list