how to use __str__ and __repr__?
Carl Banks
imbosol at aerojockey.invalid
Tue Jun 8 03:17:56 EDT 2004
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.
str(another())
--
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