Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-24 Thread Chris Barker
Ooops,

Forgot "reply all" last time -- here it is again.

On Wed, Apr 23, 2014 at 3:17 PM, Chris Barker  wrote:

> On Mon, Apr 21, 2014 at 11:39 PM, Raymond Hettinger <
> raymond.hettin...@gmail.com> wrote:
>
>> In fact, the distinction is extrinsic to their implementations.  It is
>> only important
>> because the rest of the language tends to treat them differently.  For
>> example,
>> you could store ['raymond', 'red'] as a list or as a tuple ('raymond',
>> 'red'), but you
>> wouldn't be punished until later when you tried:
>>
>>  'I think %s likes %s' % container # str.__mod__ treats lists and
>> tuples differently
>>
>
> I've been bitten by that a lot -- I always wondered why that didn't work
> with any sequence. like "tuple unpacking", which is really sequence
> unpacking:
>
> x, y = [3,4]
>
> But anyway, when I teach Python, I do struggle with this issue -- I tend
> to give the explanation of "structs" vs. "homogenous sequences", but I feel
> like I am repeating a party line, rather than anything useful.  What I do
> is:
>
> If it needs to be immutable (dict key), then use a tuple
> If it needs to be mutable, then use a list
>
> Otherwise, you can use either, but I tend to use a tuple for small things
> I don't need to mutate, regardless of whether they are homogenous or not --
> it makes me feel better to get the perception of a *tiny* bit more
> efficiency.
>
> And sometimes you want to mutate small collections of inhomogeneous values
> (C sructs are mutable, after all).
>
> So I don't think this needs to be codified this in the docs anywhere.
>
>
>>  Likewise, there seems to be wide-spread confusion about make makes an
>> object immutable.  People seem to miss that ints, tuples, None and str are
>> immutable only because they lack any mutating methods,
>>
>
> not sure your point here -- that under the hood one could mutate them with
> C code?
>



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.go 
___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-23 Thread Chris Angelico
On Thu, Apr 24, 2014 at 1:59 PM, Łukasz Langa  wrote:
> On Apr 17, 2014, at 11:49 AM, Brett Cannon  wrote:
>
>> Think of tuples like a struct in C, lists like an array.
>
>
> I generally agree but it’s a bit more complex, for instance when you have a
> homogenous sequence but want it to be hashable. I just hit that today and
> felt a little bad using tuple because of that “struct” mindset :)

All you need is a "frozenlist" type, parallel to "frozenset":

frozenlist = tuple # Magic!

some_dict[frozenlist([...])] = some_value

ChrisA
___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-23 Thread Łukasz Langa
On Apr 17, 2014, at 11:49 AM, Brett Cannon  wrote:

> Think of tuples like a struct in C, lists like an array.

I generally agree but it’s a bit more complex, for instance when you have a 
homogenous sequence but want it to be hashable. I just hit that today and felt 
a little bad using tuple because of that “struct” mindset :)

-- 
Best regards,
Łukasz Langa

WWW: http://lukasz.langa.pl/
Twitter: @llanga
IRC: ambv on #python-dev

___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-22 Thread Stephen J. Turnbull
Leandro Pereira de Lima e Silva writes:

 >> In teaching Python, I find that analogs to other languages are
 >> helpful in explaining Python even if a person doesn't know the other
 >> language.
 >>     sorted(set(open(somefile)))
 >> is like:
 >>     cat somefile | sort | uniq       # different algorithm, same outcome
 >> or:
 >>     SELECT DISTINCT line FROM somelines ORDER BY line;

 > I think that it helps by making the learning curve less steep,
 > although it also has the potential to produce poor code because
 > different languages may have different idioms to solving different
 > problems.

True, of course.  I think what Raymond is saying is that these
other-language examples can help smooth over those "¿Qué pasa?"
moments, so the teacher can focus on style and idiomatic coding in the
language at hand.  Some teachers will use them more than others do.

On the other hand, there's no need to purge them from the docs and
tutorials.  If someone notices that some example/analogy seems likely
to get in the way of understanding, they can and should write a patch
to improve that example.
___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-22 Thread Leandro Pereira de Lima e Silva
That's rather vague, isn't it? "Usually contains" isn't nearly as
prescriptive as "should be used for".

A co-worker with whom I discussed the matter these days also argued that a
language shouldn't prescribe as one uses a data structure, although I do
think conventions in semantics helps maintainability.

Leandro


2014-04-18 16:59 GMT-03:00 Ezio Melotti :

> Hi,
>
> On Thu, Apr 17, 2014 at 10:23 PM, Guido van Rossum 
> wrote:
> > It's definitely something that should be put in some documentation,
>
> see http://bugs.python.org/issue14840 and
> https://docs.python.org/3/tutorial/datastructures.html#tuples-and-sequences
> :
> """
> Though tuples may seem similar to lists, they are often used in
> different situations and for different purposes. Tuples are immutable,
> and usually contain an heterogeneous sequence of elements that are
> accessed via unpacking (see later in this section) or indexing (or
> even by attribute in the case of namedtuples). Lists are mutable, and
> their elements are usually homogeneous and are accessed by iterating
> over the list.
> """
>
> Best Regards,
> Ezio Melotti
>
> > 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 
> wrote:
> >>
> >>
> >>
> >> On Thu Apr 17 2014 at 2:43:35 PM, Leandro Pereira de Lima e Silva
> >>  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
> >> 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)
> >
> > ___
> > 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/ezio.melotti%40gmail.com
> >
> ___
> 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/leandropls%40cpti.cetuc.puc-rio.br
>
___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-22 Thread Leandro Pereira de Lima e Silva
>
> In teaching Python, I find that analogs to other languages are helpful
> in explaining Python even if a person doesn't know the other language.
> sorted(set(open(somefile)))
> is like:
> cat somefile | sort | uniq   # different algorithm, same outcome
> or:
>SELECT DISTINCT line FROM somelines ORDER BY line;


I think that it helps by making the learning curve less steep, although it
also has the potential to produce poor code because different languages may
have different idioms to solving different problems. Much like if try to
think in English and translate word by word to Spanish, for example (you'll
probably get by, but it won't really be like how a native in that language
does).

Leandro


2014-04-22 3:39 GMT-03:00 Raymond Hettinger :

>
> On Apr 18, 2014, at 1:21 AM, Jeff Allen  wrote:
>
> 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?
>
>
> In teaching Python, I find that analogs to other languages are helpful
> in explaining Python even if a person doesn't know the other language.
>
> sorted(set(open(somefile)))
>
> is like:
>
> cat somefile | sort | uniq   # different algorithm, same outcome
>
> or:
>
>SELECT DISTINCT line FROM somelines ORDER BY line;
>
> In particular, it is effective to say that tuples are used like structs in
> other languages
> or like records in database tables.
>
> I don't think we should go down the road of removing all the similes and
> metaphors
> from the docs.   While children don't usually benefit from them, adults
> face different
> learning challenges.  Usually, their biggest learning hurdle is
> figuring-out what is
> and what is not a valid comparison to other things they already know.
>
> One problem I have seen with the usual list vs tuple explanations is that
> they seem to suggest that the list-are-for-looping and
> tuples-are-like-records
> notions are baked into the implementation of lists and tuples.
>
> In fact, the distinction is extrinsic to their implementations.  It is
> only important
> because the rest of the language tends to treat them differently.  For
> example,
> you could store ['raymond', 'red'] as a list or as a tuple ('raymond',
> 'red'), but you
> wouldn't be punished until later when you tried:
>
>  'I think %s likes %s' % container # str.__mod__ treats lists and
> tuples differently
>
> Likewise, there seems to be wide-spread confusion about make makes an
> object immutable.  People seem to miss that ints, tuples, None and str are
> immutable only because they lack any mutating methods,
>
>
> Raymond
>
>
>
> ___
> 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/leandropls%40cpti.cetuc.puc-rio.br
>
>
___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-21 Thread Raymond Hettinger

On Apr 18, 2014, at 1:21 AM, Jeff Allen  wrote:

> 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? 

In teaching Python, I find that analogs to other languages are helpful
in explaining Python even if a person doesn't know the other language.

sorted(set(open(somefile)))

is like:

cat somefile | sort | uniq   # different algorithm, same outcome

or:

   SELECT DISTINCT line FROM somelines ORDER BY line;

In particular, it is effective to say that tuples are used like structs in 
other languages
or like records in database tables.

I don't think we should go down the road of removing all the similes and 
metaphors
from the docs.   While children don't usually benefit from them, adults face 
different
learning challenges.  Usually, their biggest learning hurdle is figuring-out 
what is
and what is not a valid comparison to other things they already know.

One problem I have seen with the usual list vs tuple explanations is that
they seem to suggest that the list-are-for-looping and tuples-are-like-records
notions are baked into the implementation of lists and tuples.

In fact, the distinction is extrinsic to their implementations.  It is only 
important
because the rest of the language tends to treat them differently.  For example,
you could store ['raymond', 'red'] as a list or as a tuple ('raymond', 'red'), 
but you
wouldn't be punished until later when you tried:

 'I think %s likes %s' % container # str.__mod__ treats lists and 
tuples differently

Likewise, there seems to be wide-spread confusion about make makes an
object immutable.  People seem to miss that ints, tuples, None and str are
immutable only because they lack any mutating methods,


Raymond


___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-18 Thread Ezio Melotti
Hi,

On Thu, Apr 17, 2014 at 10:23 PM, Guido van Rossum  wrote:
> It's definitely something that should be put in some documentation,

see http://bugs.python.org/issue14840 and
https://docs.python.org/3/tutorial/datastructures.html#tuples-and-sequences
:
"""
Though tuples may seem similar to lists, they are often used in
different situations and for different purposes. Tuples are immutable,
and usually contain an heterogeneous sequence of elements that are
accessed via unpacking (see later in this section) or indexing (or
even by attribute in the case of namedtuples). Lists are mutable, and
their elements are usually homogeneous and are accessed by iterating
over the list.
"""

Best Regards,
Ezio Melotti

> 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  wrote:
>>
>>
>>
>> On Thu Apr 17 2014 at 2:43:35 PM, Leandro Pereira de Lima e Silva
>>  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
>> 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)
>
> ___
> 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/ezio.melotti%40gmail.com
>
___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-18 Thread Nick Coghlan
On 18 April 2014 04:21, Jeff Allen  wrote:
>
> 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.

This is the kind of "competence to mastery" transition my "Python
User's Reference" was designed to cover, but the book contract fell
through, and I was never able to interest anyone in rescuing the
material from the ODF manuscript and migrating it to Sphinx after I
donated it to the PSF:
http://svn.python.org/view/sandbox/trunk/userref/

(It's also all 2.5 era docs, so would need a fair bit of work to bring
it up to date for 2.7 and 3.4)

Regards,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-18 Thread Jeff Allen


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" > 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 mailto:bcan...@gmail.com>> wrote:



On Thu Apr 17 2014 at 2:43:35 PM, Leandro Pereira de Lima e
Silva 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 
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 )






___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-17 Thread Leandro Pereira de Lima e Silva
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"  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  wrote:
>
>>
>>
>> On Thu Apr 17 2014 at 2:43:35 PM, Leandro Pereira de Lima e Silva <
>> 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
>> 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)
>
___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-17 Thread Guido van Rossum
No, I don't think it belongs in the style guide. It is not about code
formatting or naming, it is about data structure design and API design.


On Thu, Apr 17, 2014 at 12:49 PM, Leandro Pereira de Lima e Silva <
leandro...@cpti.cetuc.puc-rio.br> 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"  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  wrote:
>>
>>>
>>>
>>> On Thu Apr 17 2014 at 2:43:35 PM, Leandro Pereira de Lima e Silva <
>>> 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
>>> 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)
>>
>


-- 
--Guido van Rossum (python.org/~guido)
___
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


Re: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

2014-04-17 Thread Guido van Rossum
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  wrote:

>
>
> On Thu Apr 17 2014 at 2:43:35 PM, Leandro Pereira de Lima e Silva <
> 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
> 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)
___
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