[Python-3000] tp_bytes and __bytes__ magic method
Guido van Rossum
guido at python.org
Thu Aug 9 00:54:47 CEST 2007
On 8/8/07, Christian Heimes <lists at cheimes.de> wrote:
> Victor Stinner just made a good point at #python. The py3k has no magic
> method and type slot for bytes. Python has magic methods like __int__
> for int(ob) and __str__ for str(ob). Are you considering to add a
> __bytes__ method and tp_bytes?
Never occurred to me. The intention is that bytes() has a fixed
signature. It's far less important than str(). __int__() is different,
numeric types must be convertible.
> I can think of a bunch of use cases for a magic method.
Such as?
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list