CARVIEW |
Select Language
HTTP/2 200
date: Sun, 24 Aug 2025 11:48:09 GMT
server: Apache/2.4.41 (Ubuntu)
vary: Cookie,User-Agent,Accept-Encoding
content-encoding: gzip
content-type: text/html; charset=utf-8
x-clacks-overhead: GNU Terry Pratchett
strict-transport-security: max-age=315360000; includeSubDomains; preload
IntegerConversion - JythonWiki
CPython function |
Jython method |
int PyObject.asInt() |
|
PyObject* intobject::PyInt_FromString(char *s, char **pend, int base) |
|
Py_ssize_t intobject::PyInt_AsSsize_t(register PyObject *op) |
int PyObject.__int__().asInt() |
Py_ssize_t abstract::PyNumber_AsSsize_t(PyObject *item, PyObject *err) |
int PyObject.asIndex(err) |
boolean PyObject.isIndex() |
When using asInt, consider whether you want to ensure the original object is an instanceof PyInteger/PyLong prior to calling asInt on it. It's common to do this check before calling asInt, but is not required -- otherwise asInt will attempt to implicitly convert non int/longs via user defined __int__ methods.
IntegerConversion (last edited 2008-11-15 09:16:02 by localhost)