How to get/set class attributes in Python

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Sun Jun 12 16:16:08 EDT 2005


Chris Spencer a écrit :
> Bruno Desthuilliers wrote:
> 
>> And *this* is highly unpythonic. And un-OO too, since it makes foo() 
>> dependant on *class* Bar, when it should most probably be enough that 
>> it only depends on (probably part of) the *interface* of class Bar. 
> 
> I was providing the original poster with a simple way to ensure 
> appropriate type.

s/appropriate type/specific implementation/

Hint : the appropriate type for print >> XXX is "whatever has a 
'write(anything_that_can_be_coerced_to_a_string)' method".



More information about the Python-list mailing list