Compare commits
No commits in common. 'supermaster-dev' and 'supermaster' have entirely different histories.
supermaste
...
supermaste
@ -1,19 +0,0 @@ |
|||||||
def my(self, attr): |
|
||||||
try: |
|
||||||
return object.__getattr__(self, attr) |
|
||||||
except AttributeError: |
|
||||||
return 0 |
|
||||||
|
|
||||||
|
|
||||||
def implicit_int(cls): |
|
||||||
cls.__getattr__ = my |
|
||||||
return cls |
|
||||||
|
|
||||||
|
|
||||||
@implicit_int |
|
||||||
class A: |
|
||||||
pass |
|
||||||
|
|
||||||
|
|
||||||
a = A() |
|
||||||
print(a.e) |
|
@ -1,17 +0,0 @@ |
|||||||
import time |
|
||||||
|
|
||||||
|
|
||||||
class Timer: |
|
||||||
time = __import__("time") |
|
||||||
def __enter__(self): |
|
||||||
self.st = time.time() |
|
||||||
def __exit__(self, exc_type, exc_val, exc_tb): |
|
||||||
if exc_type is None: |
|
||||||
print(time.time() - self.st) |
|
||||||
return False |
|
||||||
import random |
|
||||||
with Timer(): |
|
||||||
a = 0 |
|
||||||
for i in range(1000000): |
|
||||||
a += random.randint(0, 1000) |
|
||||||
print(a) |
|
Loading…
Reference in new issue