Guido van Rossum wrote: >> I can think of a bunch of use cases for a magic method. > > Such as?
The __bytes__ method could be used to implement a byte representation of an arbitrary object. The byte representation can then be used to submit the object over wire or dump it into a file. In Python 2.x I could overwrite __str__ to send an object over a socket but in Python 3k str() returns a unicode object that can't be transmitted over sockets. Sockets support bytes only. Christian _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
