Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.python.core.PyObject
org.python.core.PySequence
public abstract class PySequence
extends PyObject
Nested Class Summary |
Nested classes/interfaces inherited from class org.python.core.PyObject | |
PyObject.ConversionException |
Field Summary |
Fields inherited from class org.python.core.PyObject | |
exposed_name |
Constructor Summary | |
|
Method Summary | |
void |
|
void |
|
PyObject | |
PyObject |
|
PyObject |
|
PyObject | |
PyObject |
|
PyObject |
|
PyObject | |
PyObject |
|
PyObject | |
PyObject | |
PyObject | |
boolean |
|
void |
|
void |
|
void |
|
Object |
|
boolean | |
boolean |
public void __delitem__(PyObject index)
Equivalent to the standard Python __delitem__ method.
- Overrides:
- __delitem__ in interface PyObject
- Parameters:
public void __delslice__(PyObject s_start, PyObject s_stop, PyObject s_step)
- Overrides:
- __delslice__ in interface PyObject
public PyObject __eq__(PyObject o)
Equivalent to the standard Python __eq__ method.
- Parameters:
- Returns:
- the result of the comparison.
public PyObject __finditem__(int index)
A variant of the __finditem__ method which accepts a primitiveint
as the key. By default, this method will call__finditem__(PyObject key)
with the appropriate args. The only reason to override this method is for performance.
- Overrides:
- __finditem__ in interface PyObject
- Parameters:
- Returns:
- the value corresponding to key or null if key is not found.
- See Also:
PyObject.__finditem__(PyObject)
public PyObject __finditem__(PyObject index)
Very similar to the standard Python __getitem__ method. Instead of throwing a KeyError if the item isn't found, this just returns null. Classes that wish to implement __getitem__ should override this method instead (with the appropriate semantics.
- Overrides:
- __finditem__ in interface PyObject
- Parameters:
- Returns:
- the value corresponding to key or null if key is not found
public PyObject __ge__(PyObject o)
Equivalent to the standard Python __ge__ method.
- Parameters:
- Returns:
- the result of the comparison.
public PyObject __getitem__(PyObject index)
Equivalent to the standard Python __getitem__ method. This method should not be overridden. Override the__finditem__
method instead.
- Overrides:
- __getitem__ in interface PyObject
- Parameters:
- Returns:
- the value corresponding to that key.
- See Also:
PyObject.__finditem__(PyObject)
public PyObject __getslice__(PyObject s_start, PyObject s_stop, PyObject s_step)
- Overrides:
- __getslice__ in interface PyObject
public PyObject __gt__(PyObject o)
Equivalent to the standard Python __gt__ method.
- Parameters:
- Returns:
- the result of the comparison.
public PyObject __iter__()
Return an iterator that is used to iterate the element of this sequence. From version 2.2, this method is the primary protocol for looping over sequences. If a PyObject subclass should support iteration based in the __finditem__() method, it must supply an implementation of __iter__() like this:public PyObject __iter__() { return new PySequenceIter(this); }When iterating over a python sequence from java code, it should be done with code like this:PyObject iter = seq.__iter__(); for (PyObject item; (item = iter.__iternext__()) != null;) { // Do somting with item }
- Since:
- 2.2
public PyObject __le__(PyObject o)
Equivalent to the standard Python __le__ method.
- Parameters:
- Returns:
- the result of the comparison.
public PyObject __lt__(PyObject o)
Equivalent to the standard Python __lt__ method.
- Parameters:
- Returns:
- the result of the comparison.
public PyObject __ne__(PyObject o)
Equivalent to the standard Python __ne__ method.
- Parameters:
- Returns:
- the result of the comparison.
public boolean __nonzero__()
Equivalent to the standard Python __nonzero__ method. Returns whether of not a givenPyObject
is considered true.
- Overrides:
- __nonzero__ in interface PyObject
public void __setitem__(int index, PyObject value)
A variant of the __setitem__ method which accepts a primitiveint
as the key. By default, this will call__setitem__(PyObject key, PyObject value)
with the appropriate args. The only reason to override this method is for performance.
- Overrides:
- __setitem__ in interface PyObject
- Parameters:
value
- the value to set this key to
public void __setitem__(PyObject index, PyObject value)
Equivalent to the standard Python __setitem__ method.
- Overrides:
- __setitem__ in interface PyObject
- Parameters:
value
- the value to set this key to
public void __setslice__(PyObject s_start, PyObject s_stop, PyObject s_step, PyObject value)
- Overrides:
- __setslice__ in interface PyObject
public Object __tojava__(Class c) throws PyIgnoreMethodTag
Equivalent to the Jython __tojava__ method. Tries to coerce this object to an instance of the requested Java class. Returns the special objectPy.NoConversion
if thisPyObject
can not be converted to the desired Java class.
- Overrides:
- __tojava__ in interface PyObject
- Parameters:
c
- the Class to convert thisPyObject
to.
public boolean isMappingType() throws PyIgnoreMethodTag
- Overrides:
- isMappingType in interface PyObject
public boolean isNumberType() throws PyIgnoreMethodTag
- Overrides:
- isNumberType in interface PyObject