Possible to have multiple loop variables?

Alan Franzoni alan.franzoni.blahblah at example.com.invalid
Thu Jul 31 10:44:08 CEST 2008


laredotornado was kind enough to say:

> How would I set up the ms1 array such that I can use three items per
> object?

Use tuples. But that should depend on which values make up the key for your
mapping.

E.g.
ms1 = {('managed1':7019):8020, ('managed2':7020):8021}
ms2 = {'managed1':(7019:8020), 'managed2':(7020:8021)}

depending on what you want, and then iterate over such structure just like
Marc suggested.

Otherwise, you can create a custom class which returns three-tuples when
iterated, in such case you can just extract m, lp, ssl_lp in the for cycle
just like your example.



-- 
Alan Franzoni <alan.franzoni.xyz at gmail.com>
-
Remove .xyz from my email in order to contact me.
-
GPG Key Fingerprint:
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E



More information about the Python-list mailing list