Instances of classes inheriting from str, tuple, etc cannot be weakly referenced. Does anyone know the reason for this? >>> from weakref import proxy >>> class Object(object): pass >>> x = Object() >>> y = proxy(x) # no problem here >>> class Str(str): pass >>> x = Str() >>> y = proxy(x) # but why won't this work? Traceback (most recent call last): File "<pyshell#9>", line 1, in -toplevel- y = proxy(x) TypeError: cannot create weak reference to 'Str' object Weak referencing would be much more useful to me if it included strings, tuples, and such. Right now, my awkward workaround is substituting UserString or some other wrapper class replacing inheritance with delegation. Raymond Hettinger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20040529/1ab23f85/attachment.html
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4