This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: isinstance and weakref proxies.
Type: enhancement Stage: test needed
Components: Interpreter Core Versions: Python 3.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, pitrou, tuck_williamson
Priority: normal Keywords:

Created on 2003-06-05 18:51 by tuck_williamson, last changed 2022-04-10 16:09 by admin.

Messages (6)
msg61115 - (view) Author: tuck williamson (tuck_williamson) Date: 2003-06-05 18:51
I suggest adding proxy support to isinstance along the
lines of  the following pseudocode.

if object is instance of ProxyTypes:
    check using object.__class__ (which is accessed via
the proxy)
else:
    perform normal isinstance checking.

weakref.proxy is intended to hide the details of using
weakrefs . The illusion is dispelled when using
isinstance. Ideally isinstance shouldn't be modified
and the proxy class should just do the right thing, but
I am not sure that is feasable to attain that level of
info hiding while retaining the abitily to do both
isinstance(x, weakref.ProxyTypes) and isinstance(x,
xParentTypes).
msg109729 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-09 13:16
Being seven years old is this request still valid, or has it been overtaken by events?
msg114243 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-18 16:18
Closed as no reply to msg109729.
msg114250 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-08-18 17:18
It would be possible now, though perhaps inadvisable, to proxy isinstance and issubclass.
msg190039 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2013-05-26 00:23
Good to see that people are really interested in this :(
msg190079 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-05-26 12:05
Mark, this kind of message isn't useful.
The general problem here is not whether it is interesting or not, it is whether it is desireable. My own take is that it would threaten to break existing code, and that making the proxy *too* transparent would be detrimental to debuggability. But people may disagree, and this can only be solved by a discussion on e.g. python-dev.
History
Date User Action Args
2022-04-10 16:09:02adminsetgithub: 38595
2014-02-03 17:12:24BreamoreBoysetnosy: - BreamoreBoy
2013-05-26 12:05:22pitrousetnosy: + pitrou
messages: + msg190079
2013-05-26 00:23:03BreamoreBoysetmessages: + msg190039
2010-08-18 17:18:42benjamin.petersonsetstatus: closed -> open
versions: + Python 3.2
nosy: + benjamin.peterson

messages: + msg114250

resolution: out of date ->
2010-08-18 16:18:53BreamoreBoysetstatus: open -> closed
resolution: out of date
messages: + msg114243
2010-07-09 13:16:26BreamoreBoysetnosy: + BreamoreBoy
messages: + msg109729
2009-02-12 03:02:18ajaksu2setstage: test needed
2003-06-05 18:51:49tuck_williamsoncreate