Re: [Tutor] Top posters to tutor list for 2008

2009-01-01 Thread Luke Paireepinart
Yeah, I agree. Interesting script, Kent. Surprisingly short. I didn't realize I wasn't in the top 5 posters for 2008! I guess I have a new year's resolution to be more helpful. Happy New Year, everyone! On Thu, Jan 1, 2009 at 9:23 AM, jadrifter wrote: > On Thu, 2009-01-01 at 09:34 -0500, Kent

Re: [Tutor] Distinction between tuples and lists

2009-01-01 Thread Alan Gauld
"Kent Johnson" wrote For what it's worth, Guido has explicitly said, "Tuples are for heterogeneous data, list are for homogeneous data. Tuples are *not* read-only lists." That surprises me, he has always seemed more pragmatist than purist. However even Guido saying it doesn't alter the fact t

Re: [Tutor] Distinction between tuples and lists

2009-01-01 Thread Kent Johnson
On Thu, Jan 1, 2009 at 1:59 PM, Alan Gauld wrote: > lists/tuples serve many purposes in Python but one thing they most > definitely > do not do is act as hetero/homogenous containers. The authors of the blogs > may wish otherwise and indeed their debate seems to be geared around > what they would

Re: [Tutor] Inserting one dictionary into another

2009-01-01 Thread Kent Johnson
On Thu, Jan 1, 2009 at 11:04 AM, Keith Reed wrote: > I'm having trouble assigning a dictionary as a value within another: > > > Code Snippet Start > >for line in fromchild.readlines(): >itemarray = line.strip().split(":") >parentdictkey = i

Re: [Tutor] Distinction between tuples and lists

2009-01-01 Thread Alan Gauld
"Christopher Mutel" wrote I stumbled across some discussion of why the fundamental difference between lists and tuples is not mutability, but hetero- versus homogeneous data, e.g. This is not a discussion about Pythons tuples v lists per se but about how some people think they should be used

[Tutor] Inserting one dictionary into another

2009-01-01 Thread Keith Reed
I'm having trouble assigning a dictionary as a value within another: Code Snippet Start for line in fromchild.readlines(): itemarray = line.strip().split(":") parentdictkey = itemarray[0] print 'parentdictkey = ' + parentd

Re: [Tutor] Distinction between tuples and lists

2009-01-01 Thread Kent Johnson
On Thu, Jan 1, 2009 at 9:43 AM, jadrifter wrote: > Being able to use struct notation (employee.age > instead of employee[4]) would be nice but also not that difficult to > implement as a class either. Python 2.6 added collections.namedtuple() which is a factory for classes like this: http://docs.

Re: [Tutor] Distinction between tuples and lists

2009-01-01 Thread Andre Engels
On Thu, Jan 1, 2009 at 3:43 PM, jadrifter wrote: > Both data types are indexed and both can contain homogeneous (same as) > or heterogeneous (different than) data. I get that lists are analogous > to a C linked lists as tuples are to C structs. I get that the > flexibility of one and the stabil

Re: [Tutor] Distinction between tuples and lists

2009-01-01 Thread Andre Engels
On Thu, Jan 1, 2009 at 3:07 PM, Christopher Mutel wrote: > Hello all- > > I stumbled across some discussion of why the fundamental difference > between lists and tuples is not mutability, but hetero- versus > homogeneous data, e.g. > > http://jtauber.com/blog/2006/04/15/python_tuples_are_not_just_

Re: [Tutor] Top posters to tutor list for 2008

2009-01-01 Thread jadrifter
On Thu, 2009-01-01 at 09:34 -0500, Kent Johnson wrote: > For several years I have been using a simple script to find the top 20 > posters to the tutor list by web-scraping the archive pages. I thought > others might be interested so here is the list for 2008 and the script > that generates it. The

Re: [Tutor] Distinction between tuples and lists

2009-01-01 Thread jadrifter
On Thu, 2009-01-01 at 15:07 +0100, Christopher Mutel wrote: > Hello all- > > I stumbled across some discussion of why the fundamental difference > between lists and tuples is not mutability, but hetero- versus > homogeneous data, e.g. > > http://jtauber.com/blog/2006/04/15/python_tuples_are_not_j

[Tutor] Top posters to tutor list for 2008

2009-01-01 Thread Kent Johnson
For several years I have been using a simple script to find the top 20 posters to the tutor list by web-scraping the archive pages. I thought others might be interested so here is the list for 2008 and the script that generates it. The lists for previous years (back to 2003) are at the end so every

[Tutor] Distinction between tuples and lists

2009-01-01 Thread Christopher Mutel
Hello all- I stumbled across some discussion of why the fundamental difference between lists and tuples is not mutability, but hetero- versus homogeneous data, e.g. http://jtauber.com/blog/2006/04/15/python_tuples_are_not_just_constant_lists/ http://pyre.third-bit.com/blog/archives/000450.html

Re: [Tutor] Fw: Creating sub-menus?

2009-01-01 Thread spir
On Thu, 1 Jan 2009 10:58:44 + (GMT) ALAN GAULD wrote: > Forwarding to the list > Please use ReplyAll when responding. > > > > > On Wed, Dec 31, 2008 at 4:10 AM, Alan Gauld wrote: > > "nathan virgil" wrote > > > > Each menu is a function that prints out options, saves a raw_input

[Tutor] Fw: Creating sub-menus?

2009-01-01 Thread ALAN GAULD
Forwarding to the list Please use ReplyAll when responding. On Wed, Dec 31, 2008 at 4:10 AM, Alan Gauld wrote: "nathan virgil" wrote Each menu is a function that prints out options, saves a raw_input as the variable choice, and returns choice. In the main menu, each option leads to a