Mark Dickinson added the comment:

This seems like an attractive idea.  There's definitely a need for repeated 
unpacking with the same pattern, and I agree that putting the repetition into 
the pattern is suboptimal (not least from the point of view of caching structs).

One thing that feels a bit unorthogonal is that this is doing two things at 
once:  both allowing for repetition of a pattern, and also adding the lazy 
iteration.  I'd guess that there's also a use-case for allowing repetition but 
not returning an iterator;  but then that's easily covered by list(iter_unpack).

+1 from me.

Hmm;  the name.  'iterunpack'?  'iter_unpack'?  'unpack_stream'?  'unpack_all'?

Would we want something similar for packing, too?  I guess that's effectively 
covered by b''.join(s.pack(item) for item in ...).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17804>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to