[Python-Dev] Python 3000: Special type for object attributes & map keys (original) (raw)
Guido van Rossum guido at python.org
Mon Apr 7 23:44:24 CEST 2008
- Previous message: [Python-Dev] [Numpy-discussion] New project : Spyke python-to-C compiler
- Next message: [Python-Dev] string representation of range in 3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Without an implementation and supporting profile data nobody is going to believe that you can do name lookup faster than with the built-in dict type in CPython. Note that names seen by the parser are already interned, so most of what you seem to be proposing is already implemented...
On Wed, Mar 5, 2008 at 2:27 PM, Henrik Vendelbo <hvendelbo.dev at gmail.com> wrote:
It appears to me that if you can make mapping mechanisms faster in Python you can make significant overall speed improvements. I also think the proposed concept could add flexibility to persistence formats and RMI interfaces.
My basic idea is to have a constant string type with an interpreter globally unique hash. If the original constant is created in a manner different from string constants, it can be tracked and handled differently by the interpreter. Obviously most object attribute references are done with the dot operator, so I guess the interpreter already has an efficient mapping mechanism. But there must be a crossover with getattr etc, where a map of some sort is used. I imagine that having a global namespace to translate attribute names into integers could be used for several purposes by the interpreter as well as an application exchanging objects with other applications. I imagine these expressions to be supported: * attrname(string) - creates an attrname value from the string * int(attrname) - gets the hash value * string(attrname) - gets the string value Hope this makes sense Henrik P.S. I originally thought of this in a JavaScript context so forgive me if this would make little difference in Python.
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] [Numpy-discussion] New project : Spyke python-to-C compiler
- Next message: [Python-Dev] string representation of range in 3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]