[EMAIL PROTECTED] wrote: > I don't like the forced padding out of the last chunk (mostly because my code > which uses a function like this doesn't call for one) > > def partition(v,n,pad=0): > if pad is not None: > t=(v+[pad]*(n-len(v)%n)) > return [t[i:i+n] for i in range(0,len(v),n)] > > of course, this makes it so you can't pad out with None, but this shouldn't > be too much of a problem?
How about if pad is a list, then it pads cyclically with that list. To pad with none, just set pad=[None]. Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---