[Tutor] Unexpected iterator

spir denis.spir at free.fr
Mon Nov 16 06:17:27 CET 2009


Le Sun, 15 Nov 2009 19:23:33 -0000,
"Alan Gauld" <alan.gauld at btinternet.com> s'exprima ainsi:

> What does 'unpack' mean?  I've seen a few Python errors about packing
> and unpacking.  What does it mean?  

Unpacking is rarely needed. It matches some kind of problems.
Imagine you parse "codes" each made of name-sep-number. Then when walking through the result you can write:
for code in codes:
	(name,sep,number) = code

(parens not needed) It's just an elegant manner to avoid indexing -- right?

Denis
--------------------------------
* la vita e estrany *

http://spir.wikidot.com/





More information about the Tutor mailing list