> How about making offset a standard integer, and change the signature to > return tuple when it is used: > item, offset = unpack(format, rec, offset) # Partial unpacking
Well, it would work well when unpack results are assigned to individual vars: x,y,offset=unpack( "ii", rec, offset) but it gets more complicated if you have something like: coords=unpack("10i", rec) How would you pass/return offsets here? As an extra element in coords? coords=unpack("10i", rec, offset) offset=coords.pop() But that would be counterintuitive and somewhat inconvinient.. Ilya On Sat, 8 Jan 2005, Nick Coghlan wrote: > Ilya Sandler wrote: > > item=unpack( "IIII", rec, offset) > > How about making offset a standard integer, and change the signature to > return a > tuple when it is used: > > item = unpack(format, rec) # Full unpacking > offset = 0 > item, offset = unpack(format, rec, offset) # Partial unpacking > > The second item in the returned tuple being the offset of the first byte after > the end of the unpacked item. > > Cheers, > Nick. > > -- > Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia > --------------------------------------------------------------- > http://boredomandlaziness.skystorm.net > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/ilya%40bluefir.net > _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com