slice with negative stride

2007-10-06 Thread ajcppmod
I'm really confused about results of slices with negative strides. For example >>mystr = 'my string' I would have then thought of the contents of mystr as: indices0 1 2 3 4 5 6 7 8 contentm y s t r i n g with mystr[:3] = 'my ' Can someone explain to me how mystr[:3:-1] = 'gnirt'? I

flatten sequences in a dictionary

2008-01-09 Thread ajcppmod
Hi I wondering if someone could give me a pointer. I have a dictionary with the following structure: testDict = dict(foo=((1,2,3),(1,4,3)), bar=((3,2,1),(9,8,7,)), mumble=((1,2,3),)) I am trying to create a list of the the 3 element tuples using itertools (just for a bit of fun). I'm trying this

Re: ISO Python example projects (like in Perl Cookbook)

2008-01-10 Thread ajcppmod
Have a look at Dive into Python by Mark Pilgrim. It is available for free here http://www.diveintopython.org/. Andy -- http://mail.python.org/mailman/listinfo/python-list

Test driven development

2008-01-24 Thread ajcppmod
Hi Sorry if this is a bit off topic but as unit testing is such a cornerstone of python development I thought a few of you may be able to share your knowledge/experiences. I like the concept of TDD but find it difficult to put into practice most of the time. I think this primarily because I tend