> 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 | ncoghlan at email.com | Brisbane, Australia > --------------------------------------------------------------- > http://boredomandlaziness.skystorm.net > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: http://mail.python.org/mailman/options/python-dev/ilya%40bluefir.net >
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4