Time travel - how to simplify?
Andrew Z
formisc at gmail.com
Tue Nov 14 01:05:50 EST 2017
My implied solution is incorrect.
I should start with using the date type and, for example, dateutil package
for date manipulation and building the dictionary of needed dates/months.
And only after that, map against the fut_suffix.
On Tue, Nov 14, 2017 at 12:56 AM, Andrew Z <formisc at gmail.com> wrote:
> 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