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.
19 lines
325 B
19 lines
325 B
# test overriding builtins
|
|
|
|
import builtins
|
|
|
|
# override generic builtin
|
|
try:
|
|
builtins.abs = lambda x: x + 1
|
|
except AttributeError:
|
|
import sys
|
|
print("SKIP")
|
|
sys.exit()
|
|
|
|
print(abs(1))
|
|
|
|
# __build_class__ is handled in a special way
|
|
builtins.__build_class__ = lambda x, y: ('class', y)
|
|
class A:
|
|
pass
|
|
print(A)
|
|
|