RE: Static parameter count

2005-03-17 Thread Tertius Cronje
> > elif len(L) == 5: > > return struct.pack(fmt,L[0] , L[1], L[2], L[3], L[4]) > > elif len(L) == 6: > > return struct.pack(fmt,L[0] , L[1], L[2], L[3], L[4], L[5]) > > > > # etc... etc... etc ... > > return struct.pack(fmt, *L) > > Should do the trick

Re: Static parameter count

2005-03-17 Thread Ola Natvig
Tertius Cronje wrote: Hi all, This does not feel Pythonic. Is there a better way to do the same? Many TIA T # L = [1,2,3,4,5,6, etc] # L can contain 'n' elements # fmt is made up to each particular specification if len(L) == 0: return '' el

Static parameter count

2005-03-17 Thread Tertius Cronje
Hi all, This does not feel Pythonic. Is there a better way to do the same? Many TIA T # L = [1,2,3,4,5,6, etc] # L can contain 'n' elements # fmt is made up to each particular specification if len(L) == 0: return ''