RE: Ordered list question

2011-07-18 Thread jyoung79
>> Can you share a website that goes into more detail on this good variable >> naming? > I'd Google that one. You'll find more articles than you can read in a > lifetime... Very true! :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Ordered list question

2011-07-18 Thread Chris Angelico
On Mon, Jul 18, 2011 at 2:12 PM, wrote: > Can you share a website that goes into more detail on this good variable > naming? I'd Google that one. You'll find more articles than you can read in a lifetime... ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Ordered list question

2011-07-17 Thread jyoung79
Thank you Chris, Dan and Thomas for your replies. I really appreciate your insight, and I will look into the information you have given me. Dan, I've never heard of a "treap" or "red-black tree", so I'll be interested to research these. Thomas, Thanks very much for giving me further knowledg

Re: Ordered list question

2011-07-17 Thread Dan Stromberg
If you need "read everything, then sort once", then a dictionary (or collections.defaultdict if you require undefined's) and a single sort at the end is probably the way to go. If you truly need an ordered datastructure (because you're reading one element, using things sorted, reading another elem

Re: Ordered list question

2011-07-17 Thread Thomas 'PointedEars' Lahn
jyoun...@kc.rr.com wrote: ^^ Something is missing there. > I'm currently working on a project where I'm looping through xml elements, > pulling the 'id' attribute (which will be coerced to a number) No, usually it won't. > as well as the element tag. That's element _type name_.

Re: Ordered list question

2011-07-17 Thread Chris Angelico
On Mon, Jul 18, 2011 at 2:28 AM, wrote: > My question is, does python have a similar way to do something like this? > I'm assuming the best way is to create a dictionary and then sort it by > the keys? > That would be one way to do it. If you know beforehand what the highest ID is, you could cre