[Python-3000] Principles (was: Two proposals for a new list-like type: one modest, one radical) (original) (raw)
Josiah Carlson jcarlson at uci.edu
Mon Apr 23 22:13:23 CEST 2007
- Previous message: [Python-3000] Principles (was: Two proposals for a new list-like type: one modest, one radical)
- Next message: [Python-3000] Principles
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bill Janssen <janssen at parc.com> wrote:
> Base types should be as simple as possible. Is that really a good idea? Wouldn't we wind up with BLISS (unsigned integers)?
With everything, there is a balance. I do not advocate removing functionality to make an object simpler; that would be absurd. On the other hand, when we already have types that are necessarily as simple as possible to implement a reasonable set of functionality (lists, tuples, integers, floats, dictionaries, str, etc.), I think that's a good starting point.
Now, do we replace a structure which is very easy to understand and maintain with a structure that necessarily isn't as easy to understand and maintain? What if it breaks 3rd party code that expects the old implementation? At what point do we say that certain performance improvements are or are not significant enough to balance API breakage, performance assumptions, etc.?
I believe that no performance improvement warrants such large scale breakage of 3rd party extensions. This is the same reason why I didn't support the string view+concatenation mechanism that was offered by Larry Hastings.
I think it's always desirable to provide more useful base types, but that it has to be balanced against conversion and maintenance costs.
Indeed. As a base type, I don't believe a BTree implementation replacing the array implementation of a list is a good thing.
Guido seems to be against the addition of yet another type into collections (which has defaultdict and deque in 2.5). Me, I'd be happy to have this object in collections (as I said, I've implemented this kind of thing before).
Depending on my mood, I may even support replacing the deque implementation with the Daniel's BTree, as the timings that Daniel has provided show that inserting and deleting is quite fast for moderately sized sequences (10k elements). When people ask, "I want a list-like thing that is able to do X", we can tell them, "use a deque, it's really fast for just about everything". Later when people invariably ask, "if it's fast for most everything, why doesn't it replace list?" we can tell them, "it breaks too many 3rd party extensions that rely on the array-based implementation of list."
- Josiah
- Previous message: [Python-3000] Principles (was: Two proposals for a new list-like type: one modest, one radical)
- Next message: [Python-3000] Principles
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]