Re: Further adventures in array slicing.

2007-05-04 Thread Alex Martelli
Steven W. Orr <[EMAIL PROTECTED]> wrote: ... > I need to unpack this into three seperate arrays called name, fields, > valid. The old code looked like this: You're using lists, not arrays. If you DID want arrays, you'd have to import standard library module array, and you'd be limited to a few

Re: Further adventures in array slicing.

2007-05-04 Thread 7stud
> A second question is: When can you use += vs .append(). > Are the two always the same? They are never the same unless you only add one item to the list. append() will only increase the length of a list by 1. la = [1,2] lb = [3, 4, 5] la += lb print la lc = [1,2] lc.append(lb) print lc --outpu

Re: Further adventures in array slicing.

2007-05-04 Thread John Machin
On May 5, 7:03 am, "Steven W. Orr" <[EMAIL PROTECTED]> wrote: > This is more for my education and not so much for practicality. > [snip] > > A second question is: When can you use += vs .append(). Are the two always > the same? > Formally, they can never be the same. They can be used to produce th

Further adventures in array slicing.

2007-05-04 Thread Steven W. Orr
This is more for my education and not so much for practicality. I have a structure that sort of looks like this: mdict = {33:{'name': 'Hello0', 'fields':'fields0', 'valid': 'valid0' 55:{'name': 'Hello1', 'fields':'fields1', 'valid': 'v