2014-12-09 16:19:48 +00:00
|
|
|
# test overriding builtins
|
|
|
|
|
|
|
|
import builtins
|
|
|
|
|
|
|
|
# override generic builtin
|
2017-02-14 21:57:56 +00:00
|
|
|
try:
|
|
|
|
builtins.abs = lambda x: x + 1
|
|
|
|
except AttributeError:
|
|
|
|
print("SKIP")
|
2017-06-10 18:03:01 +01:00
|
|
|
raise SystemExit
|
2017-02-14 21:57:56 +00:00
|
|
|
|
2014-12-09 16:19:48 +00:00
|
|
|
print(abs(1))
|
|
|
|
|
|
|
|
# __build_class__ is handled in a special way
|
|
|
|
builtins.__build_class__ = lambda x, y: ('class', y)
|
|
|
|
class A:
|
|
|
|
pass
|
|
|
|
print(A)
|