Do I always have to write "self." ?

Martijn Faassen m.faassen at vet.uu.nl
Mon May 1 10:05:48 EDT 2000


Samuel A. Falvo II <kc5tja at garnet.armored.net> wrote:
> In article <B53241E5.580F%abrahams at mediaone.net>, Dave Abrahams wrote:
>>As Simonyi, the author of the Hungarian notation concept writes, "the basic
>>idea is to name all quantities by their types". If you are naming quantities
>>by their interface, you are taking a step away from Hungarian. Do as I do,
>>naming quantities by their *role*, and you have taken a long leap away from
>>Hungarian.

> If an object exposes a particular interface, then it is guaranteed to be of
> a particular type.  Defining parameters in terms of their roles is
> analogous.  Again, I just don't see the distinction.

Not in Python it ain't:

class Foo:
    def do_it(self):
        print "Foo!"

class Bar:
    def do_it(self):
        print "Bar!"

Are Foo and Bar of the same type? They definitely expose the same interface.
But by convention, not type. You seem to be aware of this, so I'm not
sure why you don't see any distinction. :)

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list