MCPcopy Create free account
hub / github.com/dabeaz/python-cookbook / Date

Class Date

src/9/multiple_dispatch_with_function_annotations/example1.py:96–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94# Example: overloaded __init__
95import time
96class Date(metaclass=MultipleMeta):
97 def __init__(self, year: int, month:int, day:int):
98 self.year = year
99 self.month = month
100 self.day = day
101
102 def __init__(self):
103 t = time.localtime()
104 self.__init__(t.tm_year, t.tm_mon, t.tm_mday)
105
106if __name__ == '__main__':
107 s = Spam()

Callers 1

example1.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected