def increment(x):
x += 10
return x
value = 5
new_value = increment(value)
print(value + new_value)
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
class A:
def __new__(cls):
return 42
def __init__(self):
print("Init")
print(A())
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
data = {'a': [1, 2], 'b': [3, 4]}
data['c'] = data['a'] + data['b']
data['a'].append(5)
print(len(data['c']))#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
class A: pass
class B(A): pass
class C(A): pass
class D(B, C): pass
print(D.mro()[1].__name__)
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Forwarded from Заметки Питониста
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM