Guido's new method definition idea
News123
news123 at free.fr
Sun Dec 7 06:43:13 EST 2008
Sorry Dennis,
I don't understand your answer.
I'm not very knowledgable with all the OO vocabulary, but just use OO.
self.a , self.b , self.c are stored in the object and could later be
used by other object-methods.
like
def print_a_b_c(self):
print self,a,self.b,self.c
the name 'class_elements' was just a suggestion it could be also
something like 'auto_prepend_self' or whatever.
bye
N
Dennis Lee Bieber wrote:
> On Sat, 06 Dec 2008 19:02:22 +0100, News123 <news123 at free.fr> declaimed
> the following in comp.lang.python:
>
>
>> example:
>> class C:
>> class_elements a,b,c,d
>>
>> def method(self,arg):
>> global d
>> a,b,c = arg[0..3]
>> d = a + b
>> self.e = a + d
>>
>> instead of
>> class C:
>> def method(self,arg):
>> self.a,self.b,self.c,self.d = arg[0..4]
>> self.e = self.a + self.b
>>
> I would declare this a poor example, since a, b, c, aren't used as
> attributes -- they are just invocation locals.
More information about the Python-list
mailing list