01: // Copyright (c) Corporation for National Research Initiatives
02: package org.python.core;
03:
04: /**
05: * A python slice object.
06: */
07:
08: public class PySlice extends PyObject {
09: public PyObject start, stop, step;
10:
11: public PySlice(PyObject start, PyObject stop, PyObject step) {
12: if (start == null)
13: start = Py.None;
14: if (stop == null)
15: stop = Py.None;
16: if (step == null)
17: step = Py.One;
18:
19: this .start = start;
20: this .stop = stop;
21: this .step = step;
22: }
23:
24: public PyString __str__() {
25: return new PyString(start.__repr__() + ":" + stop.__repr__()
26: + ":" + step.__repr__());
27: }
28:
29: public PyString __repr__() {
30: return new PyString("slice(" + start.__repr__() + ", "
31: + stop.__repr__() + ", " + step.__repr__() + ")");
32: }
33:
34: public boolean isSequenceType() {
35: return false;
36: }
37: }
|