[Python-Dev] Implmentation details for bin/oct/hex

Raymond Hettinger python at rcn.com
Tue Jun 24 15:56:37 CEST 2008


From: "Nick Coghlan" <ncoghlan at gmail.com>
> The 3.0 approach means that non-float floating point types still can't be displayed properly by bin()/oct()/hex(). The current 2.6 
> approach means every such class has to implement its own equivalent of PyNumber_ToBase.

Feel free to change the implementation details however you like as long as the basic functionality stays the same.  To support 
non-float floating point types, replace the float check with isinstance(v, real).  The rest of PyNumber_ToBase looks fine to me 
since it supports anything with an __index__ method.

Raymond









More information about the Python-Dev mailing list