[issue14308] '_DummyThread' object has no attribute '_Thread__block'

Richard Oudkerk report at bugs.python.org
Fri Apr 20 00:08:04 CEST 2012


Richard Oudkerk <shibturn at gmail.com> added the comment:

> I don't think _DummyThread can override __stop(), because of the name
> mangling of __private methods. However, the hasattr() approach would
> probably work.

Wouldn't a _DummyThread._Thread__stop() method override Thread.__stop()?  Like

>>> class A(object):
...     def foo(self):
...         self.__bar()
...     def __bar(self):
...         print "original"
...
>>> class B(A):
...     def _A__bar(self):
...         print "overridden"
...
>>> B().foo()
overridden

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14308>
_______________________________________


More information about the Python-bugs-list mailing list