[issue1530559] struct.pack raises TypeError where it used to convert
Mark Dickinson
report at bugs.python.org
Mon Mar 1 20:37:17 CET 2010
Mark Dickinson <dickinsm at gmail.com> added the comment:
I'd be open to re-allowing use of __int__ (and __long__) consistently for all integer packing codes in 2.7, as a temporary measure; I'd really prefer not to allow this for 3.x.
What would make more sense, IMO, would be to allow use of the __index__ method (in both 2.7 and 3.x) to convert custom non-integer classes to integers before packing; this is supposed to be the modern approach to creating integer-like classes that can be used as integers (e.g., in list indices). Andreas, would this work for you, or do you need to be able to use __int__ and/or __long__?
Re-opening while we're discussing this.
----------
status: closed -> open
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1530559>
_______________________________________
More information about the Python-bugs-list
mailing list