Wrap an owned PyObject*. This should typically only be used in conjuction with functions in the deimos API that return PyObject* (they return new references). Otherwise, wrap the incoming PyObject* with borrowed.
Own a borrowed PyObject* and wrap it.
Constructs an instance of the Py_None PydObject.
Destructor. Calls Py_DECREF on PyObject reference.
exposes a lowish-level wrapper of the new-style buffer interface
Equivalent to abs(this) for numbers, and this.abs() otherwise.
Equivalent to 'this.append(item)' in python.
Converts any Python number to float.
Converts any Python number to int.
Converts any iterable PydObject to a list
Converts any Python number to long.
Converts any iterable PydObject to a tuple
Get a BufferView of this object. Will fail if this does not support the new buffer interface.
Get a BufferView of this object without probing for capabilities. Will fail if this does not support the new buffer interface.
Equivalent to bytes(this) in Python.
Equivalent to callable(this) in Python.
For dicts, wraps PyDict_Clear. Otherwise forwards to method.
For dicts, wraps PyDict_Copy. Otherwise forwards to method.
Equivalent to 'this.count(v)' in Python.
Equivalent to del o_key in Python.
Equivalent to del o['_key'] in Python. Usually only makes sense for mappings.
Equivalent to del o_i in Python. Usually only makes sense for sequences.
Equivalent to del o[_i1:_i2] in Python.
Equivalent to del o[:] in Python.
Equivalent to del this.attr_name in Python.
Equivalent to del this.attr_name in Python.
Equivalent to dir(this) in Python.
Equivalent to divmod(this, o) for numbers, and this.divmod(o) otherwise.
Forwards to PyNumber_FloorDivide for numbers, and method otherwise.
Equivalent to getattr(this, attr_name) in Python.
Equivalent to getattr(this, attr_name) in Python.
For module objects, wraps PyModule_GetDict (essentially a dir() operation in Python). Otherwise forwards to method.
Equivalent to 'key in this' in Python.
Equivalent to hasattr(this, attr_name) in Python.
Equivalent to hasattr(this, attr_name) in Python.
Equivalent to hash(this) in Python.
Equivalent to 'this.index(v)' in Python
Equivalent to 'this.insert(i,item)' in python.
Equivalent to isinstance(this, cls) in Python.
Equivalent to issubclass(this, cls) in Python. Only works if this is a class.
Equivalent to 'this.items()' in Python.
Equivalent to 'this.keys()' in Python.
The length of this PydObject. Equivalent to _len(this) in Python.
For dicts, wraps PyDict_Merge. Otherwise forwards to method.
Calls a method of the object with any convertible D items.
Calls the PydObject method with args.
Calls the PydObject method with positional and keyword arguments.
Equivalent to "not this" in Python.
Iterates over the items in a collection, be they the items in a sequence, keys in a dictionary, or some other iteration defined for the PydObject's type.
Iterate over (key, value) pairs in a dictionary. If the PydObject is not a dict, this simply does nothing. (It iterates over no items.) You should not attempt to modify the dictionary while iterating through it, with the exception of modifying values. Adding or removing items while iterating through it is an especially bad idea.
Forwards to appropriate Python binary operator overload.
Equivalent to "v in this" in Python.
Calls the PydObject with any convertible D items.
Exposes Python object comparison to D. Equivalent to cmp(this, rhs) in Python.
Forwards to method.
Exposes Python object equality check to D.
Equivalent to o_key in Python.
Equivalent to o['_key'] in Python; usually only makes sense for mappings.
Equivalent to o_i in Python; usually only makes sense for sequences.
Equivalent to o_key = _value in Python.
Forwards to appropriate python in-place operator overload.
Equivalent to o[_i1:_i2] in Python.
Equivalent to o[:] in Python.
Equivalent to o[_i1:_i2] = _v in Python.
Equivalent to o[:] = _v in Python.
Forwards to appropriate Python unary operator overload.
Equivalent to pow(this, exp, mod) for numbers, and this.pow(exp,mod) otherwise.
Equivalent to repr(this) in Python.
Equivalent to 'this.reverse()' in Python.
Equivalent to setattr(this, attr_name, v) in Python.
Equivalent to setattr(this, attr_name, v) in Python.
Equivalent to length()
Equivalent to 'this.sort()' in Python.
Equivalent to str(this) in Python.
Allows use of PydObject in writeln via %s
Convert this object to instance of T.
Forwards to PyNumber_TrueDivide for numbers, and method otherwise.
Gets the type of this PydObject. Equivalent to type(this) in Python.
Equivalent to unicode(this) in Python.
Calls the PydObject with args.
Calls the PydObject with positional and keyword arguments.
Equivalent to 'this.values()' in Python.
Forwards to getattr
Forwards to setattr
Returns a borrowed reference to the PyObject.
Wrapper class for a Python/C API PyObject.
Nearly all of these member functions may throw a PythonException if the underlying Python API raises a Python exception.