Time travel - how to simplify?

Andrew Z formisc at gmail.com
Tue Nov 14 00:56:03 EST 2017


well, yeah, it's unidirectional and final destination is always the same
and have little to do with the question.

Say, i have a dict:

fut_suffix ={ 1 : 'F',
              2 : 'G',
              3 : 'H',
              4 : 'J',
              5 : 'K',
              6 : 'M',
              7 : 'N',
              8 : 'Q',
              9 : 'U',
              10: 'V',
              11: 'X',
              12: 'Z'
              }

where key is a month.
Now i want to get certain number of months. Say, i need  3 months duration
starting from any month in dict.

so if i start @ 7th:
my_choice =7
 for mnth, value in fut_suffix:
    if my_choice >= mnth
       # life is great
but if :
my_choice = 12 then my "time travel" becomes pain in the neck..

And as such - the question is - what is the smart way to deal with cases
like this?

Thank you
AZ



More information about the Python-list mailing list