A better way to accomplish loop

Discussion in 'Python' started by Joseph L. Casale, Feb 12, 2013.

  1. I have an issue with some code I have been passed:

    for (x, y) in [(a_dict1, a_tuple[0]), (a_dict2, a_tuple[1])]:


    I only noticed it as PyCharm failed to assign the str type to y, whereas itknew
    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!
    jlc
    Joseph L. Casale, Feb 12, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. flamesrock

    XML: Better way to accomplish this?

    flamesrock, Jan 3, 2005, in forum: Python
    Replies:
    2
    Views:
    285
    flamesrock
    Jan 4, 2005
  2. kellygreer1

    Standard way to accomplish production / development switch

    kellygreer1, Sep 27, 2006, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    106
    bruce barker \(sqlwork.com\)
    Sep 27, 2006
  3. Dave Angel

    Re: A better way to accomplish loop

    Dave Angel, Feb 12, 2013, in forum: Python
    Replies:
    0
    Views:
    144
    Dave Angel
    Feb 12, 2013
  4. Joseph L. Casale

    RE: A better way to accomplish loop

    Joseph L. Casale, Feb 12, 2013, in forum: Python
    Replies:
    0
    Views:
    114
    Joseph L. Casale
    Feb 12, 2013
  5. Isaac Won
    Replies:
    9
    Views:
    365
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page