You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
870 B
63 lines
870 B
6 years ago
|
from timeit import timeit
|
||
|
from collections import namedtuple
|
||
|
from array import array
|
||
|
from itertools import izip
|
||
|
from collections import deque
|
||
|
|
||
|
|
||
|
class Y(object):
|
||
|
UUU = 88
|
||
|
|
||
|
def __init__(self, x):
|
||
|
self.x = x
|
||
|
|
||
|
def s(self, x):
|
||
|
return self.x + 1
|
||
|
|
||
|
|
||
|
class X(Y):
|
||
|
A = 10
|
||
|
B = 2
|
||
|
C = 4
|
||
|
D = 9
|
||
|
|
||
|
def __init__(self, x):
|
||
|
self.x = x
|
||
|
self.stack = []
|
||
|
self.par = super(X, self)
|
||
|
|
||
|
def s(self, x):
|
||
|
pass
|
||
|
|
||
|
def __add__(self, other):
|
||
|
return self.x + other.x
|
||
|
|
||
|
def another(self):
|
||
|
return Y.s(self, 1)
|
||
|
|
||
|
def yet_another(self):
|
||
|
return self.par.s(1)
|
||
|
|
||
|
|
||
|
def add(a, b):
|
||
|
return a.x + b.x
|
||
|
|
||
|
|
||
|
t = []
|
||
|
|
||
|
Type = None
|
||
|
try:
|
||
|
print timeit(
|
||
|
"""
|
||
|
|
||
|
t.append(4)
|
||
|
t.pop()
|
||
|
|
||
|
|
||
|
|
||
|
""",
|
||
|
"from __main__ import X,Y,namedtuple,array,t,add,Type, izip",
|
||
|
number=1000000)
|
||
|
except:
|
||
|
raise
|