[Python-3000] tp_bytes and __bytes__ magic method

Christian Heimes lists at cheimes.de
Thu Aug 9 00:22:51 CEST 2007


Hey Pythonistas!

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?

I can think of a bunch of use cases for a magic method.

Christian



More information about the Python-3000 mailing list