Library of Assembled Shared Sources
pyobject_special_methods.h File Reference
#include "python_common.h"
Include dependency graph for pyobject_special_methods.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  lass
 Library for Assembled Shared Sources.
 
namespace  lass::python
 Comprehensive C++ to Python binding library.
 
namespace  lass::python::methods
 Predefined constants for Python special methods (magic methods) that can be used as method names in class export macros.
 

Functions

const lass::python::impl::ArgKwSlot lass::python::methods::_call_ ("__call__", Py_tp_call)
 __call__ method (callable semantics)
 
const lass::python::impl::UnarySlot lass::python::methods::_repr_ ("__repr__", Py_tp_repr)
 __repr__ method (must always return a string)
 
const lass::python::impl::UnarySlot lass::python::methods::_str_ ("__str__", Py_tp_str)
 __str__ method (must always return a string)
 
const lass::python::impl::UnarySlot lass::python::methods::_neg_ ("__neg__", Py_nb_negative)
 __neg__ method (unary negation)
 
const lass::python::impl::UnarySlot lass::python::methods::_pos_ ("__pos__", Py_nb_positive)
 __pos__ method (unary positive)
 
const lass::python::impl::UnarySlot lass::python::methods::_abs_ ("__abs__", Py_nb_absolute)
 __abs__ method (absolute value)
 
const lass::python::impl::UnarySlot lass::python::methods::_invert_ ("__invert__", Py_nb_invert)
 __invert__ method (bitwise inversion)
 
const lass::python::impl::UnarySlot lass::python::methods::_int_ ("__int__", Py_nb_int)
 __int__ method (must return an integer)
 
const lass::python::impl::UnarySlot lass::python::methods::_long_ ("__long__", Py_nb_int)
 alias for __int__ method
 
const lass::python::impl::UnarySlot lass::python::methods::_float_ ("__float__", Py_nb_float)
 __float__ method (must return a float)
 
const lass::python::impl::BinarySlot lass::python::methods::_add_ ("__add__", Py_nb_add)
 __add__ method (binary addition)
 
const lass::python::impl::BinarySlot lass::python::methods::_sub_ ("__sub__", Py_nb_subtract)
 __sub__ method (binary subtraction)
 
const lass::python::impl::BinarySlot lass::python::methods::_mul_ ("__mul__", Py_nb_multiply)
 __mul__ method (binary multiplication)
 
const lass::python::impl::BinarySlot lass::python::methods::_mod_ ("__mod__", Py_nb_remainder)
 __mod__ method (modulus)
 
const lass::python::impl::BinarySlot lass::python::methods::_lshift_ ("__lshift__", Py_nb_lshift)
 __lshift__ method (left shift)
 
const lass::python::impl::BinarySlot lass::python::methods::_rshift_ ("__rshift__", Py_nb_rshift)
 __rshift__ method (right shift)
 
const lass::python::impl::BinarySlot lass::python::methods::_and_ ("__and__", Py_nb_and)
 __and__ method (bitwise and)
 
const lass::python::impl::BinarySlot lass::python::methods::_xor_ ("__xor__", Py_nb_xor)
 __xor__ method (bitwise xor)
 
const lass::python::impl::BinarySlot lass::python::methods::_or_ ("__or__", Py_nb_or)
 __or__ method (bitwise or)
 
const lass::python::impl::BinarySlot lass::python::methods::_iadd_ ("__iadd__", Py_nb_inplace_add)
 __iadd__ method (in-place addition)
 
const lass::python::impl::BinarySlot lass::python::methods::_isub_ ("__isub__", Py_nb_inplace_subtract)
 __isub__ method (in-place subtraction)
 
const lass::python::impl::BinarySlot lass::python::methods::_imul_ ("__imul__", Py_nb_inplace_multiply)
 __imul__ method (in-place multiplication)
 
const lass::python::impl::BinarySlot lass::python::methods::_imod_ ("__imod__", Py_nb_inplace_remainder)
 __imod__ method (in-place modulus)
 
const lass::python::impl::BinarySlot lass::python::methods::_ilshift_ ("__ilshift__", Py_nb_inplace_lshift)
 __ilshift__ method (in-place left shift)
 
const lass::python::impl::BinarySlot lass::python::methods::_irshift_ ("__irshift__", Py_nb_inplace_rshift)
 __irshift__ method (in-place right shift)
 
const lass::python::impl::BinarySlot lass::python::methods::_iand_ ("__iand__", Py_nb_inplace_and)
 __iand__ method (in-place bitwise and)
 
const lass::python::impl::BinarySlot lass::python::methods::_ixor_ ("__ixor__", Py_nb_inplace_xor)
 __ixor__ method (in-place bitwise xor)
 
const lass::python::impl::BinarySlot lass::python::methods::_ior_ ("__ior__", Py_nb_inplace_or)
 __ior__ method (in-place bitwise or)
 
const lass::python::impl::BinarySlot lass::python::methods::_truediv_ ("__truediv__", Py_nb_true_divide)
 __truediv__ method (true division)
 
const lass::python::impl::BinarySlot lass::python::methods::_itruediv_ ("__itruediv__", Py_nb_inplace_true_divide)
 __itruediv__ method (in-place true division)
 
const lass::python::impl::BinarySlot lass::python::methods::_floordiv_ ("__floordiv__", Py_nb_floor_divide)
 __floordiv__ method (floor division)
 
const lass::python::impl::BinarySlot lass::python::methods::_ifloordiv_ ("__ifloordiv__", Py_nb_inplace_floor_divide)
 __ifloordiv__ method (in-place floor division)
 
const lass::python::impl::BinarySlot lass::python::methods::_matmul_ ("__matmul__", Py_nb_matrix_multiply)
 __matmul__ method (matrix multiplication)
 
const lass::python::impl::BinarySlot lass::python::methods::_imatmul_ ("__imatmul__", Py_nb_inplace_matrix_multiply)
 __imatmul__ method (in-place matrix multiplication)
 
const lass::python::impl::InquirySlot lass::python::methods::_bool_ ("__bool__", Py_nb_bool)
 __bool__ method (boolean conversion)
 
const lass::python::impl::TernarySlot lass::python::methods::_pow_ ("__pow__", Py_nb_power)
 __pow__ method (exponentiation)
 
const lass::python::impl::TernarySlot lass::python::methods::_ipow_ ("__ipow__", Py_nb_inplace_power)
 __ipow__ method (in-place exponentiation)
 
const lass::python::impl::ComparatorSlot lass::python::methods::_lt_ ("__lt__", Py_LT)
 __lt__ method (less than)
 
const lass::python::impl::ComparatorSlot lass::python::methods::_le_ ("__le__", Py_LE)
 __le__ method (less than or equal)
 
const lass::python::impl::ComparatorSlot lass::python::methods::_eq_ ("__eq__", Py_EQ)
 __eq__ method (equal)
 
const lass::python::impl::ComparatorSlot lass::python::methods::_ne_ ("__ne__", Py_NE)
 __ne__ method (not equal)
 
const lass::python::impl::ComparatorSlot lass::python::methods::_gt_ ("__gt__", Py_GT)
 __gt__ method (greater than)
 
const lass::python::impl::ComparatorSlot lass::python::methods::_ge_ ("__ge__", Py_GE)
 __ge__ method (greater than or equal)
 
const lass::python::impl::LenSlot lass::python::methods::_len_ ("__seq_len__", Py_sq_length)
 __len__ method (length of the sequence)
 
const lass::python::impl::SsizeArgSlot lass::python::methods::_getitem_ ("__seq_getitem__", Py_sq_item)
 __getitem__ method (get item by index)
 
const lass::python::impl::SsizeObjArgSlot lass::python::methods::_setitem_ ("__seq_setitem__", Py_sq_ass_item)
 __setitem__ method (set item by index)
 
const lass::python::impl::LenSlot lass::python::methods::seq_len_ ("__seq_len__", Py_sq_length)
 __len__ method (length of the sequence)
 
const lass::python::impl::BinarySlot lass::python::methods::_concat_ ("__concat__", Py_sq_concat)
 __concat__ method (concatenation)
 
const lass::python::impl::SsizeArgSlot lass::python::methods::_repeat_ ("__repeat__", Py_sq_repeat)
 __repeat__ method (repetition)
 
const lass::python::impl::SsizeArgSlot lass::python::methods::seq_getitem_ ("__seq_getitem__", Py_sq_item)
 __getitem__ method (get item by index)
 
const lass::python::impl::SsizeObjArgSlot lass::python::methods::seq_setitem_ ("__seq_setitem__", Py_sq_ass_item)
 __setitem__ method (set item by index)
 
const lass::python::impl::ObjObjSlot lass::python::methods::_contains_ ("__contains__", Py_sq_contains)
 __contains__ method (membership test)
 
const lass::python::impl::BinarySlot lass::python::methods::_iconcat_ ("__iconcat__", Py_sq_inplace_concat)
 __iconcat__ method (in-place concatenation)
 
const lass::python::impl::SsizeArgSlot lass::python::methods::_irepeat_ ("__irepeat__", Py_sq_inplace_repeat)
 __irepeat__ method (in-place repetition)
 
const lass::python::impl::LenSlot lass::python::methods::map_len_ ("__map_len__", Py_mp_length)
 __len__ method (length of the mapping)
 
const lass::python::impl::BinarySlot lass::python::methods::map_getitem_ ("__map_getitem__", Py_mp_subscript)
 __getitem__ method (get item by key)
 
const lass::python::impl::ObjObjArgSlot lass::python::methods::map_setitem_ ("__map_setitem__", Py_mp_ass_subscript)
 __setitem__ method (set item by key)
 
const lass::python::impl::IterSlot lass::python::methods::_iter_ ("__iter__", Py_tp_iter)
 __iter__ method (iterator)
 
const lass::python::impl::IterNextSlot lass::python::methods::next ("__next__", Py_tp_iternext)
 __next__ method (iterator next)
 

Variables

const lass::python::impl::InquirySlot lass::python::methods::_nonzero_ = _bool_
 alias for __bool__ method
 
const lass::python::impl::ObjObjArgSlot lass::python::methods::map_delitem_ = map_setitem_
 __delitem__ method (delete item by key, shares same slot as __setitem__)
 

Detailed Description

Author
Bram de Greve (bram@.nosp@m.coca.nosp@m.mware.nosp@m..com)
Tom De Muer (tom@c.nosp@m.ocam.nosp@m.ware..nosp@m.com)

*** BEGIN LICENSE INFORMATION ***

The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://lass.sourceforge.net/cpal-license. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The Original Code is LASS - Library of Assembled Shared Sources.

The Initial Developer of the Original Code is Bram de Greve and Tom De Muer. The Original Developer is the Initial Developer.

All portions of the code written by the Initial Developer are: Copyright (C) 2004-2025 the Initial Developer. All Rights Reserved.

Contributor(s):

Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 or later (the GPL), in which case the provisions of GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the CPAL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL License. If you do not delete the provisions above, a recipient may use your version of this file under either the CPAL or the GPL.

*** END LICENSE INFORMATION ***

Definition in file pyobject_special_methods.h.