Handling Property and internal ('__') attribute inheritance and creation

Fredrik Lundh fredrik at pythonware.com
Tue Aug 19 11:51:37 CEST 2008


Eric Brunel wrote:

> To add to what others have already said, it is not only 'just extra 
> work', it is also quite dangerous. See:
> 
> class A(object):
>   children = []

the OP is aware of that, of course:

 > I set anything that is constant but anything variable is set again in
 > __init__()

as long as if you're aware of the issues involved (which you should be 
if you're using Python professionally), using class-level attributes is 
a perfectly valid Python style.

</F>




More information about the Python-list mailing list