Frage

When executing the following lines with an IDLE prompt, the execution is blocking forever at the last line.

>>> class Foo(unicode):
        pass

>>> foo = Foo('bar')
>>> print str(foo)     # prints bar
>>> print repr(foo)    # prints u'bar'
>>> print foo          # blocks forever!!

This is weird because it is working as expected when executed from python.exe console. This might be related with this question, but I am not sure. I am using python 2.7.5 32-bit with Windows 7 x64. Can someone explain me what is happening here? Thank you!

EDIT: Some more tests...

If I save the class Foo(unicode): pass in C:\Python27\Lib\site-packages\mymodule.py

Now IDLE does not block with the following code:

>>> from mymodule import Foo
>>> print Foo('bar') # prints bar like expected.
War es hilfreich?

Lösung

FYI, after reproducing, I opened a bug report for you, here:

http://bugs.python.org/issue19481

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top