Re: newbie write to file question

2005-12-04 Thread Rob E
> I'm not sure what I'm > missing so I'd appreciate some advice. You question is pretty general and I'm not going to go over this in any great detail, but I will make a few comments. * In your if section use if ... else constructs not all the strange if and then not if blocks. Also get rid

Re: Efficient lookup in list of dictionaries

2005-12-04 Thread Rob E
> Hi. I like working with lists of dictionaries since order is preserved > in a list when I want order and the dictionaries make it explicit what > I have got inside them. I find this combination very useful for storing > constants especially. Generally I find myself either needing to > retriev

Re: Strange behavior of int()

2006-01-29 Thread Rob E
> Why is int(r/k), where r = 0.5 and k = 0.5 = 0? Shouldn't it be 1? > And why is the last one = 4 and not 5? I dont' know why the differences in your exact case. However, please realise that Regardless of the programming language good programming practice is to never rely on the int of a float

Re: List append

2007-09-15 Thread Rob E
On Sat, 15 Sep 2007 03:25:27 +, mouseit wrote: > I'm trying to add an element to a list which is a property of an > object, stored in an array. When I append to one element, all of the > lists are appended! > > Example Code: > > class Test: > array = [] > > myTests = [Test() , Test() ,

Re: scope of variables

2006-05-03 Thread Rob E
> is the code below correct? > > b = 3 > def adding(a) > print a + b > > it seams not to see the up-level scope where b is defined. Yes except for the missing : at the end of the "def" line. Rob -- http://mail.python.org/mailman/listinfo/python-list