[Python-Dev] Re: optimizing non-local object access (original) (raw)
Guido van Rossum guido@python.org
Thu, 09 Aug 2001 18:03:59 -0400
- Previous message: [Python-Dev] Re: optimizing non-local object access
- Next message: [Python-Dev] Re: optimizing non-local object access
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Jeremy]
It would because dict wouldn't be a dictionary; it would be a dlict (dictionary-list hybrid). This is the one compatibility issue that has come up. Code that expects module's to have a real dictionary will break -- both in Python where it is probably quite rare and at the C level where some API calls require real dicts. The dict object will implement the mapping protocol. It just won't be a dict.
In 2.2, if you don't use getitem for access-by-number, you could subclass dictionary and add a separate set of APIs to access the variables by number (and to assign numbers to them in the first place). Then it would still behave like a real dictionary enough to be usable for the PyDict_* C API functions.
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Re: optimizing non-local object access
- Next message: [Python-Dev] Re: optimizing non-local object access
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]