How to get/set class attributes in Python

Chris Spencer usenet.20.evilspam at spamgourmet.com
Sun Jun 12 17:00:25 EDT 2005


Bruno Desthuilliers wrote:
> Chris Spencer a écrit :
> 
>> 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".

Certainly, although now I think you're splitting hairs over my 
terminology. Let's synchronize our wording with a point made in the 
Python docs. Section 2.1 of the Library Reference recommends that the 
builtin function isinstance() be used for testing the object type. Does 
this then mean that "type" refers to the class of an object? In which 
case, wouldn't "interface" refer to a collection of methods, that when 
present in a class create an implementation?

Chris



More information about the Python-list mailing list