To create a syntax close to what you want, subclass int to add new methods (the built-in int type is unmodifiable so a subclass is the only option for extending integer behaviors). Compute the date offsets using timedelta in the datetime module:
>>> from datetime import date, timedelta
>>> class Int(int):
def days_ago(self):
return date.today() - timedelta(days=self)
def days_from_now(self):
return date.today() + timedelta(days=self)
>>> Int(3).days_ago()
datetime.date(2013, 4, 5)
>>> Int(4).days_from_now()
datetime.date(2013, 4, 12)