-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Steve Howell wrote: > --- On Wed, 1/27/10, Alex Gaynor <alex.gay...@gmail.com> wrote: > >> "Python lists implement a pretty useless data structure" >> >> It's very difficult for ideas to gain traction when they >> contain such >> useless, and obviously wrong, rhetoric. There's an >> enormous body of >> code out there that begs to disagree with this assertion. >> > > The statement was meant 99% tongue in cheek. Like probably 99.99% of > Python programmers, I use lists all the time; that's why I want them to > be more versatile. > > There's also a 1% element of truth to the statement. To the extent > that people are arguing for alternative data structures to list, > particularly deque, I wonder if there actually is some merit in > discouraging the use of lists in favor of better alternatives.
Your tongue must surely still be firmly wedged to the side: I would say it was more like "five nines" of the uses of Python lists never even contemplate pop(0), and not because the programmer is worried about performance: most lists aren't being used as FIFOs. The overwhelming majority of uses is going to be for cases where pure iteration is all that is required; a smaller but significant class needs random access, and a very tiny set would use pop at either end. If I wanted a scalable / performant FIFO, then I would use a deque, because that is what deques are for. Note that in this case I wouldn't care about O(1) indexing, because a FIFO is not useful when random access is needed. If I was just fooling around, then the cost of pop(0) on a list wouldn't matter. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkthvLcACgkQ+gerLs4ltQ6omwCfQBKyn1n2Sk+oknrQ+RQbZNp+ I2cAnRyutpRq7Y4LgXCQQyWFy3DX4ZxP =0ekf -----END PGP SIGNATURE----- _______________________________________________ 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