Created
April 28, 2016 00:18
-
-
Save PuercoPop/6a1392fada7498137731d881f6a79c75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_year_month(year_month): | |
return year_month.split("-") | |
def find_teams_that_disappeared_in_month(year_month): | |
current_year, current_month = parse_year_month(year_month) | |
if current_month == "01": # O is_january(current_month) | |
return frozenset() | |
previous_month = month_before(current_month) | |
current_teams = teams_in_month(current_month) | |
previous_teams = teams_in_month(previous_month) | |
return previous_teams - current_teams | |
# Si entendi mal y no es cada enero sino 2006-01 es el epoch | |
def find_teams_that_disappeared_in_month(year_month): | |
if is_epoch(year_month): # O en su defecto months_since_epoch(year_month) > 0: | |
return frozenset() | |
previous_month = month_before(current_month) | |
current_teams = teams_in_month(current_month) | |
previous_teams = teams_in_month(previous_month) | |
return previous_teams - current_teams |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment