On Thu, Feb 06, 2003 at 08:42:59PM +0100, Just van Rossum wrote: > > [GvR] > > Could you do this as a subclass of dict? A subclass in Python would > > be inefficient, but might still be good enough for your second use > > case (the ObjC bridge). If not, a subclass in Python might be > > feasible -- it would be a little bit more work than integrating it > > into dictobject.c, but you have a lot less convincing to do, and you > > can even get it to work with Python 2.2. > > But it doesn't solve our problem. We have no control over what > dictionaries are used, either by our users directly or by the Python > library they use. We _do_ have control over the keys that are causing > troubles: our main problem is that we cannot rely on NSString instances > to be immutable, yet we need the ability to use them as keys in > (regular) dicts, just as if they were Python strings. Couldn't you add an as_key() method to NSString? Then dict access would always be like: dict[nsstring.as_key()] Neal
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