2010-09-05 | Paul Boddie | file changeset files shortlog | Fixed slice construction in the generated code. Fixed the xrange and slice builtins to use a special undefined value where the end of an xrange or slice is not defined. Added a test of class attribute usage with default function/method parameters. Moved the list slicing test into a new file, introducing a simpler testing of the slicing mechanism. |
paul@372 | 1 | #!/usr/bin/env python |
paul@372 | 2 | |
paul@373 | 3 | class C: |
paul@373 | 4 | def __getitem__(self, slice): |
paul@373 | 5 | return slice.start |
paul@372 | 6 | |
paul@373 | 7 | class D: |
paul@373 | 8 | def __getitem__(self, slice): |
paul@373 | 9 | return slice.end |
paul@373 | 10 | |
paul@373 | 11 | c = C() |
paul@373 | 12 | d = D() |
paul@373 | 13 | result_3 = c[3:] |
paul@373 | 14 | result_4 = d[:4] |
paul@372 | 15 | |
paul@372 | 16 | # vim: tabstop=4 expandtab shiftwidth=4 |