2014-12-09 11:19:48 -05:00
|
|
|
# test overriding builtins
|
|
|
|
|
|
|
|
import builtins
|
|
|
|
|
|
|
|
# override generic builtin
|
2017-02-14 16:57:56 -05:00
|
|
|
try:
|
|
|
|
builtins.abs = lambda x: x + 1
|
|
|
|
except AttributeError:
|
|
|
|
print("SKIP")
|
2017-06-10 13:03:01 -04:00
|
|
|
raise SystemExit
|
2017-02-14 16:57:56 -05:00
|
|
|
|
2014-12-09 11:19:48 -05: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)
|