Algorithms, functions, classes, regular expressions, iterators, generators, OOP, exceptions, NumPy, pandas, scikit-learn
https://telega.in/c/python_tasks
Questions — @dina_ladnyuk
Post #1728
2.43K
- 🔥 10
- 👍 2
- 😱 2
PY @python_tasks
Showing posts older than #1729 · Back to latest
# Как правильно получить доступ к атрибуту __x в экземпляре A:
class A:
def __init__(self):
self.__x = 1
a = A()
print(list(map(lambda f: f(2), (lambda x: x**i for i in range(3)))))
print(list(map(lambda f: f(2), [lambda x: x**i for i in range(3)])))
x = float('inf')
s = x - x
print(s)print(float('inf') * 2)float('inf') + float('-inf')print(type(type(bool(1))))
",".join(['1', '2', '3', '4'])
class B:
def __init__(self):
self.arr = []
def __getattr__(self, attrname):
return getattr(self.arr, attrname)
b = B()
b.append(1)
b.append(2)
b.append(3)
b.pop()
print(b.arr)