Skip to content

Commit

Permalink
Wrote code that can be reproduced in full on cover of issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
ftrain committed Jun 11, 2015
1 parent e1db77c commit ce4127d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions research/cover/cover.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This is the code from the cover of the magazine.
# Versions at https://gist.github.com/ftrain/45e1984902106bdd2c7a

import datetime

class Issue():
"""TODO write docs here"""

def __init__(self, **kwargs):
# TODO: Validate input
self.__dict__.update(kwargs)
def publish(self):
return ('This is the {0.pubdate:%B %d, %Y} issue of {0.title}. ' +
'It is {0.pages:,} pages long, and ' +
'costs ${0.price:.5}. '
'It is about {0.subject}.').format(self)

if __name__ == '__main__':
bbw = Issue(title='Bloomberg Businessweek',
price=5.99,
# That price is only USD;
# TODO figure out international pricing/currencies
pages=112,
pubdate=datetime.datetime(2015, 6, 15),
subject="code")
print(bbw.publish())

0 comments on commit ce4127d

Please sign in to comment.