--- On Wed, 1/27/10, Raymond Hettinger <raymond.hettin...@gmail.com> wrote:

> From: Raymond Hettinger <raymond.hettin...@gmail.com>

> * the current design encourages people to use
> the right data structure for a given need.  the
> proposed change makes the trades-off murky and
> implementation dependent.  

Are you saying that the current slowness of list for prepops helps people to 
choose more appropriate data structures?  Really????

> you have to know a lot more
> in order to make the right choices.  that's not
> good for usability.  we want tools that are easy to use
> correctly/well.

If you want tools that are easy to use correctly, make them bug-free and 
document their behavior.  If you want tools that are easy to use well, then 
make them perform better.  I am not sure how my patch contradicts either of 
these goals.

You keep making the argument that deque is a better alternative to list in many 
situations.  I actually agree with you.  Most programming problems are best 
modelled by a queue.  I am not sure why Python lists get all the syntax sugar 
and promotion over deque, when in reality, Python lists implement a pretty 
useless data structure.  Python lists are a glorification of a C array built on 
top of a memory-upward-biased memory allocator.  As such, they optimize list 
appends (good) but fail awfully on list prepops (bad).  They are much better as 
stacks than queues, even though queues are more useful for the most common 
programming known to man--work through a work queue and delete tasks when they 
are done.

It is not surprising that Python lists are starting to show their lack of 
versatility in 2010.  They're based on 1970's technology.  Python lists are 
really just a thin encapsulation of C arrays built on top of an asymmetrical 
memory manager.

In 2010 you could improve Python lists by releasing from the constraints of 
1970s semantics.  But I am starting to think a more modern approach would be to 
take more useful data structures like deques and give them more sugar.



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to