A better way to accomplish loop
Joseph L. Casale
jcasale at activenetwerx.com
Tue Feb 12 20:59:40 CET 2013
I have an issue with some code I have been passed:
for (x, y) in [(a_dict1, a_tuple), (a_dict2, a_tuple)]:
I only noticed it as PyCharm failed to assign the str type to y, whereas it knew
the tuples 0 and 1 item were type str.
In the loop it flags the passing of y into a method that expects type str. I can ignore
it, but looking at the loop, I cant help but think there is a better way?
Any guidance would be appreciated!
More information about the Python-list