|
|
|
You could make it easier by just using a property:
from datetime import datetime
class current_datetime(object):
....def __get__(self, instance, owner):
........return owner.now()
class new_datetime(datetime):
....current = current_datetime()
>>> new_datetime.current
new_datetime(2007, 10, 12, 18, 27, 57, 748366)
toidinamai |
Homepage |
07/10/12 - 5:37 pm | #
|
|
Cool - and it is more readable than the metaclass solution. Thanks
Michael Foord |
Homepage |
07/10/12 - 11:50 pm | #
|
|
|
Commenting by HaloScan
|