Newbie: question regarding references and class relationships

Peter Otten __peter__ at web.de
Mon Jun 10 13:07:06 EDT 2013


Rui Maciel wrote:

> Peter Otten wrote:
> 
>> I don't understand the question. My original point was that you should
>> omit class attributes that don't fulfill a technical purpose.
>> 
> 
> You've said the following:
> 
> <quote>
>> class Point:
> 
> Don't add
> 
>>         position = []
> 
> to your code. That's not a declaration, but a class attribute and in the
> long run it will cause nothing but trouble.
> </quote>
> 
> 
> We've established that you don't like attribute declarations, at least
> those
> you describe as not fulfill a technical purpose.  What I don't understand
> is why you claim that that would "cause nothing but trouble".

Have you read the code in the interpreter session I posted? 

If you do not agree that the demonstrated behaviour is puzzling I'll have to 
drop my claim...
Likewise if you can show a benefit of the

>>         position = []

line.




More information about the Python-list mailing list