1 package org.python.core; 3 4 5 8 9 public class PySlice extends PyObject { 10 public PyObject start, stop, step; 11 12 public PySlice(PyObject start, PyObject stop, PyObject step) { 13 if (start == null) start = Py.None; 14 if (stop == null) stop = Py.None; 15 if (step == null) step = Py.One; 16 17 this.start = start; 18 this.stop = stop; 19 this.step = step; 20 } 21 22 public PyString __str__() { 23 return new PyString(start.__repr__()+":"+stop.__repr__()+":"+ 24 step.__repr__()); 25 } 26 27 public PyString __repr__() { 28 return new PyString("slice("+start.__repr__()+", "+ 29 stop.__repr__()+", "+ 30 step.__repr__()+")"); 31 } 32 33 public boolean isSequenceType() { return false; } 34 } 35 | Popular Tags |