micropython/tests/basics/slice_attrs.py
Tom Soulanille aeb62f9ae3 py/objslice: Make slice attributes (start/stop/step) readable.
Configurable with MICROPY_PY_BUILTINS_SLICE_ATTRS.  Disabled by default.
2015-09-15 21:59:20 +01:00

17 lines
243 B
Python

# test builtin slice attributes access
# print slice attributes
class A:
def __getitem__(self, idx):
print(idx.start, idx.stop, idx.step)
try:
t = A()[1:2]
except:
import sys
print("SKIP")
sys.exit()
A()[1:2:3]