Issue 722763: weakref: proxy_print and proxy_repr incons. (original) (raw)

For weakref.proxy, the behavior of proxy_print() in "cooked" mode is inconsistent with the behavior of proxy_repr(). "cooked" mode printing is used when a value is displayed at the command line. Sample session:

class C: pass ... from weakref import proxy a = C() p = proxy(a) p <__main__.C instance at 0x400e864c> print repr(p) <weakproxy at 0x400e343c to instance at 0x400e864c>

The output should be the same in both cases.

(My suggestion: get rid of proxy_print. Might be a tad slower in extreme cases, but gets this right with ease. :-)