The "think of tuples like a struct in C" explanation immediately reminded me that ...

On 16/04/2014 21:42, Taavi Burns wrote (in his excellent notes from the language summit):
  The demographics have changed. How do
we change the docs and ecosystem to avoid the assumption that Python
programmers already know how to program in C?
Good question. My version was going to be that if you are dealing with tuples of mixed data like (name, age, shoesize), inserting something or sorting, in the way a list can, would confuse your code. A list, you almost always iterate over, to do the same thing with each member, and that only works if they are the same type of thing.

Then I realised David Beazley had explained this (but better), starting in the Tuples section of his "Python Essential Reference". With permission, this could perhaps be adopted wherever it best fits in the documentation.

Jeff Allen

On 17/04/2014 20:49, Leandro Pereira de Lima e Silva wrote:

This looks like an issue to be addressed at PEP-8 since it looks like a styling issue.

I haven't seen any other recommendations there on how to use a certain data structure, though.

Cheers, Leandro

Em 17/04/2014 16:24, "Guido van Rossum" <gu...@python.org <mailto:gu...@python.org>> escreveu:

    It's definitely something that should be put in some
    documentation, probably at the point when people have learned
    enough to be designing their own programs where this issue comes
    up -- before they're wizards but well after they have learned the
    semantic differences between lists and tuples.


    On Thu, Apr 17, 2014 at 11:49 AM, Brett Cannon <bcan...@gmail.com
    <mailto:bcan...@gmail.com>> wrote:



        On Thu Apr 17 2014 at 2:43:35 PM, Leandro Pereira de Lima e
        Silva <leandro...@cpti.cetuc.puc-rio.br
        <mailto:leandro...@cpti.cetuc.puc-rio.br>> wrote:

            Hello there!

            I've stumbled upon this discussion on python-dev about
            what the choice between using a list or a tuple is all
            about in 2003:
            1.
            https://mail.python.org/pipermail/python-dev/2003-March/033962.html
            2.
            https://mail.python.org/pipermail/python-dev/2003-March/034029.html

            There's a vague comment about it on python documentation
            but afaik there the discussion hasn't made into any PEPs.
            Is there an understanding about it?


        Think of tuples like a struct in C, lists like an array.
        That's just out of Guido's head so I don't think we have ever
        bothered to write it down somewhere as an important
        distinction of the initial design that should be emphasized.

        _______________________________________________
        Python-Dev mailing list
        Python-Dev@python.org <mailto:Python-Dev@python.org>
        https://mail.python.org/mailman/listinfo/python-dev
        Unsubscribe:
        https://mail.python.org/mailman/options/python-dev/guido%40python.org




-- --Guido van Rossum (python.org/~guido <http://python.org/%7Eguido>)




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

Reply via email to