"self" - a python wart or "feature"

Michal Molhanec molhanec at seznam.cz
Mon Feb 17 05:39:12 EST 2003


On 16 Feb 2003 20:04:20 -0800 Cere Davis <ceremona2000 at yahoo.com> wrote:

> Hi Pythoners,
> 
> I don't understand why Python requires "self" as the first argument in
> every function that intends to act on a instance of a given class eg:
> 
> class C:
>     def stuff(self,x):
>         print x

my experience from C++ is that hiding self (this in C++) leads to confusion
of beginners. in the C++ mailing-list I'm subscribed are often questions
caused by the fact that method has one additional argument, which isn't
visible 

  Michal



 








More information about the Python-list mailing list