News for hackers. Stuff that matters.
Re:Python: Common Newbie Mistakes, Part 1 by wahnfrieden on Sunday July 07, 2013 @12:46AM (#6001077)
The quote comes from Guido van Rossum almost verbatim so that may be a good place to start if you want to dig deeper.

As I've also seen, a good rephrasing is that lists have order whereas tuples have structure. Yet another mnemonic I've heard that seems apt is that tuples are appropriate where a named-tuple could also conceivably be used.

Re:Python: Common Newbie Mistakes, Part 1 by dalke on Monday July 08, 2013 @01:51PM (#6008039)
The quote is "Tuples are for heterogeneous data, list are for homogeneous data. Tuples are not read-only lists." Guido van Rossum March 12, 2003 in python-dev.

However, don’t treat Guido’s statement as a mandate!

"Yes, taking Guido too seriously can have that effect on people <1.1 wink> The trick is in knowing when Guido is proscribing dogmatic law, and when he is describing his intent when he designed feature(tte)s of Python, or his point of view at this moment, or how he wished people would see it, or reacting to what he had for lunch. He's just human, you know, and no more infallible than the best of us." Thomas Wouters March 12, 2003 in python-dev

For example, consider object.__class__.__bases__. That's a tuple of homogenous data. It's not of a fixed length, and the base class at a given position has no intrinsic name, other than "first", "second", etc.

Do you think the use of tuple here is a bug? Should it be a list instead?

Re:Python: Common Newbie Mistakes, Part 1 by wahnfrieden on Wednesday July 10, 2013 @12:26AM (#6017436)
Great follow-up, thanks! It's not a clear and consistent law, or law at all, you're right.
Re:Python: Common Newbie Mistakes, Part 1 by beambot on Sunday July 07, 2013 @01:44AM (#6001176)
That's crazy-interesting and seems like a very good rule of thumb. I've been using Python for a very long time and had never heard this. Why is it not in the PEP?!
Re:Python: Common Newbie Mistakes, Part 1 by wahnfrieden on Sunday July 07, 2013 @05:33PM (#6003616)
Which PEP, PEP-8? That's only a style guide. It's included in the stdlib documentation on data structures: http://docs.python.org/2/tutorial/datastructures.html#tuples...