micropython/micropython — pull request #988 by pfalcon (2014-11-26 19:47:36+00:00)
Title: Clean up differences between print() and repr_print()

To see the problem, try following commands in interactive prompt on x64:

~~~~
>>> class A: pass
...
>>> A()

>>> print(A())

~~~~

As can be seen, 1) using print() truncates %p format spec value to 32 bit. Fixing that, there's still discrepancy in that ``__repr_print__`` prints value with "0x" prefix, while print() - without. That's because former uses libc implementation of printf(), while the latter - our own. I was reluctant changing that, but figuring out that in CPython, overriding sys.stdout makes implicit interactive prints go to it, it's clear that ``__repr_print__`` should behave like ``print``.

That's still only partially resolve issue still, as:

~~~~
print(str(A()))
~~~~

still uses system routines (and has "0x" prefix), so more refactoring is needed to achieve consistency.