how to use __str__ and __repr__?
Carl Banks
imbosol at aerojockey.invalid
Tue Jun 8 03:18:53 EDT 2004
Carl Banks wrote:
>
>
> Jim Newton wrote:
>> hmm, even when i change it to calling str() rather than __str__()
>> it does not work.
>>
>> class another:
>> pass
>>
>> print another() # works
>> another().str() # does not work
>>
>> does anyone know why?
>
> str is a function, not a method.
(Ok, it's actually a type object.)
--
CARL BANKS http://www.aerojockey.com/software
"If you believe in yourself, drink your school, stay on drugs, and
don't do milk, you can get work."
-- Parody of Mr. T from a Robert Smigel Cartoon
More information about the Python-list
mailing list