21 lines
362 B
Python
21 lines
362 B
Python
class Foo:
|
|
def __init__(self, len: int):
|
|
self.len = len
|
|
|
|
def __getitem__(self, key: int):
|
|
return key
|
|
|
|
def __len__(self):
|
|
return self.len
|
|
|
|
for i in Foo(12):
|
|
print(i)
|
|
|
|
if i > 1000:
|
|
break
|
|
|
|
print(*reversed(Foo(12)), sep = " ")
|
|
|
|
Foo.__len__ = lambda self: self.len ** 2
|
|
|
|
print(*reversed(Foo(12)), sep = " ") |