the annoying, verbose self

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Mon Nov 26 20:14:50 CET 2007


Ton van Vliet a écrit :
> On 24 Nov 2007 13:56:37 GMT, Marc 'BlackJack' Rintsch <bj_666 at gmx.net>
> wrote:
(snip)
>>So::
>>
>>   def meth(self):
>>       using self:
>>           tmp = raw_input('Enter age: ')
>>           age = int(tmp)
>>
>>becomes::
>>
>>   def meth(self):
>>       using self:
>>           self.tmp = self.raw_input('Enter age: ')
>>           self.age = self.int(tmp)
>>
>>Binding `tmp` unnecessarily to the object and trying to get `raw_input()`
>>and `int()` from the object.  Ouch.  :-)
> 
> 
> Absolutely.
> 
> However, I was more thinking in terms of attributes only

Too bad : in Python, everything's an object, so 'methods' are attributes 
too.



More information about the Python-list mailing list