On Oct 4, 3:12 am, Albert Hopkins <mar...@letterboxes.org> wrote:
>       * You define a to_string() method. To have a string representation
>         of a class, one usually defines a __str__ method.  This gives
>         the advantage whereby "print myobject" or '%s' % myjobject just
>         work.


In fairness, a lot of types define a to_string() method (especially
third-party types like numpy), but it's usually to produce a raw
binary output.

Presumably in Python 3 these methods will be renamed to_bytes.


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to