C# Класс Python.Runtime.ConstructorBinding

Implements a Python type that wraps a CLR ctor call. Constructor objects support a .Overloads[] syntax to allow explicit ctor overload selection.
ClassManager stores a ConstructorBinding instance in the class's __dict__['Overloads'] SomeType.Overloads[Type, ...] works like this: 1) Python retreives the Overloads attribute from this ClassObject's dictionary normally and finds a non-null tp_descr_get slot which is called by the interpreter and returns an IncRef()ed pyHandle to itself. 2) The ConstructorBinding object handles the [] syntax in its mp_subscript by matching the Type object parameters to a contructor overload using Type.GetConstructor() [NOTE: I don't know why method overloads are not searched the same way.] and creating the BoundContructor oject which contains ContructorInfo object. 3) In tp_call, if ctorInfo is not null, ctorBinder.InvokeRaw() is called.
Наследование: ExtensionType
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ConstructorBinding ( Type type, IntPtr pyTypeHndl, ConstructorBinder ctorBinder ) : System
mp_subscript ( IntPtr op, IntPtr key ) : IntPtr

ConstructorBinding.GetItem(PyObject *o, PyObject *key) Return element of o corresponding to the object key or NULL on failure. This is the equivalent of the Python expression o[key].

tp_dealloc ( IntPtr ob ) : void
tp_descr_get ( IntPtr op, IntPtr instance, IntPtr owner ) : IntPtr

Descriptor __get__ implementation. Implements a Python type that wraps a CLR ctor call that requires the use of a .Overloads[pyTypeOrType...] syntax to allow explicit ctor overload selection.

Python 2.6.5 docs: object.__get__(self, instance, owner) Called to get the attribute of the owner class (class attribute access) or of an instance of that class (instance attribute access). owner is always the owner class, while instance is the instance that the attribute was accessed through, or None when the attribute is accessed through the owner. This method should return the (computed) attribute value or raise an AttributeError exception.

tp_repr ( IntPtr ob ) : IntPtr

Описание методов

ConstructorBinding() публичный Метод

public ConstructorBinding ( Type type, IntPtr pyTypeHndl, ConstructorBinder ctorBinder ) : System
type System.Type
pyTypeHndl System.IntPtr
ctorBinder ConstructorBinder
Результат System

mp_subscript() публичный статический Метод

ConstructorBinding.GetItem(PyObject *o, PyObject *key) Return element of o corresponding to the object key or NULL on failure. This is the equivalent of the Python expression o[key].
public static mp_subscript ( IntPtr op, IntPtr key ) : IntPtr
op System.IntPtr
key System.IntPtr
Результат System.IntPtr

tp_dealloc() публичный статический Метод

public static tp_dealloc ( IntPtr ob ) : void
ob System.IntPtr
Результат void

tp_descr_get() публичный статический Метод

Descriptor __get__ implementation. Implements a Python type that wraps a CLR ctor call that requires the use of a .Overloads[pyTypeOrType...] syntax to allow explicit ctor overload selection.
Python 2.6.5 docs: object.__get__(self, instance, owner) Called to get the attribute of the owner class (class attribute access) or of an instance of that class (instance attribute access). owner is always the owner class, while instance is the instance that the attribute was accessed through, or None when the attribute is accessed through the owner. This method should return the (computed) attribute value or raise an AttributeError exception.
public static tp_descr_get ( IntPtr op, IntPtr instance, IntPtr owner ) : IntPtr
op System.IntPtr PyObject* to a Constructors wrapper
instance System.IntPtr the instance that the attribute was accessed through, /// or None when the attribute is accessed through the owner
owner System.IntPtr always the owner class
Результат System.IntPtr

tp_repr() публичный статический Метод

public static tp_repr ( IntPtr ob ) : IntPtr
ob System.IntPtr
Результат System.IntPtr