At 11:04 AM 12/26/2005 -0800, Josiah Carlson wrote: >Not necessarily so as I have pointed out above. You said yourself; >practicality beats purity. While using cons cells are pure, as us using >only flat lists are pure, flat lists are practically smaller than cons >cells in certain cases (by a factor of ~4), and non-flat lists can be >smaller than cons cells in the rest of the cases.
The reason I sometimes use 2-tuples as cons cells is that it's more convenient and/or intuitive than the alternatives for some recursive algorithms. That's the practicality I'm interested in. Copying a list or doing some other hokey-pokey data structure in such cases would just be annoying and make the code harder to follow. Memory consumption and performance were never my reasons for cons-ing. Some algorithms just read more cleanly that way. In any case, regarding the usefulness of a built-in cons type, you're preaching to the choir here. My whole point here is that when you *do* need a lispy list, two-item tuples are *the* One Obvious Way to do it in Python, because the existing syntax makes them effortless to use. There's no need for a new built-in, 'cause what we already have works great. _______________________________________________ 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