Guido van Rossum wrote: > > > > But, overall the necessary changes to the implementation and to the > > > semantics (e.g. of the 'for' statement) seem prohibitive to me. > ^^^ (I meant 'from' of course) > > > Really? Even for Py3K? > > The implementation wouldn't be a problem for Py3K; I was under the > impression that you thought this could be put in earlier. Jim proposed adding namespaces to Python 2000. This will be, for my understanding, a complete rewrite and redesign that is allowed to break existing code. It would even be run in parallel to Python 1.6++ for a while, right? > But the change in semantics is very hard to swallow to me. It > definitely seems to be come murkier. > > > > I also think that the namespace implementation will be quite a bit > > > less efficient than a regular dictionary: > > > > Spacewise yes. They'd me much faster in use. This is a space/speed > > tradeoff. > > Agreed; though the speedup comes from circumventing the dictionary > altogether. I do not even believe in the space ineffectiveness. The namespace concept works fine without a dictionary and hashes at all. We can implement this as a linear list of pointers to namespace objects, since they are looked up only once, usually. But even if we would keep a dictionary-like structure as well, it is possible to implement it as an array of pointers, and you get things smaller than now, not bigger. In your analysis, you forgot to take into account that the average dictionary slot overhead gives a factor of about two. 1 dict slot = 3 words n dict entries = average 2n dict slots = 6n words versus 1 asso object = <ref, type, key, value> = 4 words n asso dict entries = average 2n words + n asso objects This gives 6n words for the proposed solution, actually as effective as today's 6n solution with dicts. Ahem :-) It can of course be that we also need a hash filed, which can be stored in the asso object. This is another word per element, so we'd have a cost increase of 1/6. As said, the dictionary is not necessary and could be created on demand (that is, if globals are really used like a dict). Without it, I count just n + 4n = 5n, actually a saving. This idea bears a lot of potential to also speed up classes and instances. Further analysis is needed, please let us not drop this idea too early. ciao - chris -- Christian Tismer :^) <mailto:tismer@appliedbiometrics.com> Applied Biometrics GmbH : Have a break! Take a ride on Python's Düppelstr. 31 : *Starship* http://starship.python.net 12163 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF we're tired of banana software - shipped green, ripens at home
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