C# 클래스 Python.Runtime.PyObject

Represents a generic Python object. The methods of this class are generally equivalent to the Python "abstract object API". See http://www.python.org/doc/current/api/object.html for details.
상속: System.Dynamic.DynamicObject, IDisposable
파일 보기 프로젝트 열기: pythonnet/pythonnet 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
obj IntPtr

공개 메소드들

메소드 설명
AsManagedObject ( Type t ) : object

AsManagedObject Method

Return a managed object of the given type, based on the value of the Python object.

DelAttr ( PyObject name ) : void

DelAttr Method

Delete the named attribute of the Python object, where name is a PyObject wrapping a Python string or unicode object. This method throws a PythonException if the attribute set fails.

DelAttr ( string name ) : void

DelAttr Method

Delete the named attribute of the Python object. This method throws a PythonException if the attribute set fails.

DelItem ( PyObject key ) : void

DelItem Method

For objects that support the Python sequence or mapping protocols, delete the item at the given object index. This method raises a PythonException if the delete operation fails.

DelItem ( int index ) : void

DelItem Method

For objects that support the Python sequence or mapping protocols, delete the item at the given numeric index. This method raises a PythonException if the delete operation fails.

DelItem ( string key ) : void

DelItem Method

For objects that support the Python sequence or mapping protocols, delete the item at the given string index. This method raises a PythonException if the delete operation fails.

Dir ( ) : PyList

Dir Method

Return a list of the names of the attributes of the object. This is equivalent to the Python expression "dir(object)".

Dispose ( ) : void
Equals ( object o ) : bool

Equals Method

Return true if this object is equal to the given object. This method is based on Python equality semantics.

FromManagedObject ( object ob ) : PyObject

FromManagedObject Method

Given an arbitrary managed object, return a Python instance that reflects the managed object.

GetAttr ( PyObject name ) : PyObject

GetAttr Method

Returns the named attribute of the Python object or raises a PythonException if the attribute access fails. The name argument is a PyObject wrapping a Python string or unicode object.

GetAttr ( PyObject name, PyObject _default ) : PyObject

GetAttr Method

Returns the named attribute of the Python object, or the given default object if the attribute access fails. The name argument is a PyObject wrapping a Python string or unicode object.

GetAttr ( string name ) : PyObject

GetAttr Method

Returns the named attribute of the Python object, or raises a PythonException if the attribute access fails.

GetAttr ( string name, PyObject _default ) : PyObject

GetAttr Method

Returns the named attribute of the Python object, or the given default object if the attribute access fails.

GetEnumerator ( ) : IEnumerator

GetEnumerator Method

Return a new PyIter object for the object. This allows any iterable python object to be iterated over in C#. A PythonException will be raised if the object is not iterable.

GetHashCode ( ) : int

GetHashCode Method

Return a hashcode based on the Python object. This returns the hash as computed by Python, equivalent to the Python expression "hash(obj)".

GetItem ( PyObject key ) : PyObject

GetItem Method

For objects that support the Python sequence or mapping protocols, return the item at the given object index. This method raises a PythonException if the indexing operation fails.

GetItem ( int index ) : PyObject

GetItem Method

For objects that support the Python sequence or mapping protocols, return the item at the given numeric index. This method raises a PythonException if the indexing operation fails.

GetItem ( string key ) : PyObject

GetItem Method

For objects that support the Python sequence or mapping protocols, return the item at the given string index. This method raises a PythonException if the indexing operation fails.

GetIterator ( ) : PyObject

GetIterator Method

Return a new (Python) iterator for the object. This is equivalent to the Python expression "iter(object)". A PythonException will be raised if the object cannot be iterated.

GetPythonType ( ) : PyObject

GetPythonType Method

Returns the Python type of the object. This method is equivalent to the Python expression: type(object).

HasAttr ( PyObject name ) : bool

HasAttr Method

Returns true if the object has an attribute with the given name, where name is a PyObject wrapping a string or unicode object.

HasAttr ( string name ) : bool

HasAttr Method

Returns true if the object has an attribute with the given name.

Invoke ( ) : PyObject

Invoke Method

Invoke the callable object with the given arguments, passed as a PyObject[]. A PythonException is raised if the invokation fails.

Invoke ( PyObject args, PyDict kw ) : PyObject

Invoke Method

Invoke the callable object with the given positional and keyword arguments. A PythonException is raised if the invokation fails.

Invoke ( PyTuple args ) : PyObject

Invoke Method

Invoke the callable object with the given arguments, passed as a Python tuple. A PythonException is raised if the invokation fails.

Invoke ( PyTuple args, PyDict kw ) : PyObject

Invoke Method

Invoke the callable object with the given positional and keyword arguments. A PythonException is raised if the invokation fails.

InvokeMethod ( string name ) : PyObject

InvokeMethod Method

Invoke the named method of the object with the given arguments. A PythonException is raised if the invokation is unsuccessful.

InvokeMethod ( string name, PyObject args, PyDict kw ) : PyObject

InvokeMethod Method

Invoke the named method of the object with the given arguments and keyword arguments. Keyword args are passed as a PyDict object. A PythonException is raised if the invokation is unsuccessful.

InvokeMethod ( string name, PyTuple args ) : PyObject

InvokeMethod Method

Invoke the named method of the object with the given arguments. A PythonException is raised if the invokation is unsuccessful.

InvokeMethod ( string name, PyTuple args, PyDict kw ) : PyObject

InvokeMethod Method

Invoke the named method of the object with the given arguments and keyword arguments. Keyword args are passed as a PyDict object. A PythonException is raised if the invokation is unsuccessful.

IsCallable ( ) : bool

IsCallable Method

Returns true if the object is a callable object. This method always succeeds.

IsInstance ( PyObject typeOrClass ) : bool

IsInstance Method

Return true if the object is an instance of the given Python type or class. This method always succeeds.

IsIterable ( ) : bool

IsIterable Method

Returns true if the object is iterable object. This method always succeeds.

IsSubclass ( PyObject typeOrClass ) : bool

IsSubclass Method

Return true if the object is identical to or derived from the given Python type or class. This method always succeeds.

IsTrue ( ) : bool

IsTrue Method

Return true if the object is true according to Python semantics. This method always succeeds.

Length ( ) : int

Length Method

Returns the length for objects that support the Python sequence protocol, or 0 if the object does not support the protocol.

PyObject ( IntPtr ptr ) : System

PyObject Constructor

Creates a new PyObject from an IntPtr object reference. Note that the PyObject instance assumes ownership of the object reference and the reference will be DECREFed when the PyObject is garbage collected or explicitly disposed.

Repr ( ) : string

Repr Method

Return a string representation of the object. This method is the managed equivalent of the Python expression "repr(object)".

SetAttr ( PyObject name, PyObject value ) : void

SetAttr Method

Set an attribute of the object with the given name and value, where the name is a Python string or unicode object. This method throws a PythonException if the attribute set fails.

SetAttr ( string name, PyObject value ) : void

SetAttr Method

Set an attribute of the object with the given name and value. This method throws a PythonException if the attribute set fails.

SetItem ( PyObject key, PyObject value ) : void

SetItem Method

For objects that support the Python sequence or mapping protocols, set the item at the given object index to the given value. This method raises a PythonException if the set operation fails.

SetItem ( int index, PyObject value ) : void

SetItem Method

For objects that support the Python sequence or mapping protocols, set the item at the given numeric index to the given value. This method raises a PythonException if the set operation fails.

SetItem ( string key, PyObject value ) : void

SetItem Method

For objects that support the Python sequence or mapping protocols, set the item at the given string index to the given value. This method raises a PythonException if the set operation fails.

ToString ( ) : string

ToString Method

Return the string representation of the object. This method is the managed equivalent of the Python expression "str(object)".

TryBinaryOperation ( BinaryOperationBinder binder, Object arg, Object &result ) : bool
TryConvert ( ConvertBinder binder, object &result ) : bool
TryGetMember ( GetMemberBinder binder, object &result ) : bool
TryInvoke ( InvokeBinder binder, object args, object &result ) : bool
TryInvokeMember ( InvokeMemberBinder binder, object args, object &result ) : bool
TrySetMember ( SetMemberBinder binder, object value ) : bool
TryUnaryOperation ( UnaryOperationBinder binder, Object &result ) : bool
TypeCheck ( PyObject typeOrClass ) : bool

TypeCheck Method

Returns true if the object o is of type typeOrClass or a subtype of typeOrClass.

this ( PyObject key ) : PyObject

PyObject Indexer

Provides a shorthand for the object versions of the GetItem and SetItem methods.

this ( int index ) : PyObject

Numeric Indexer

Provides a shorthand for the numeric versions of the GetItem and SetItem methods.

this ( string key ) : PyObject

String Indexer

Provides a shorthand for the string versions of the GetItem and SetItem methods.

보호된 메소드들

메소드 설명
Dispose ( bool disposing ) : void

Dispose Method

The Dispose method provides a way to explicitly release the Python object represented by a PyObject instance. It is a good idea to call Dispose on PyObjects that wrap resources that are limited or need strict lifetime control. Otherwise, references to Python objects will not be released until a managed garbage collection occurs.

PyObject ( ) : System

비공개 메소드들

메소드 설명
CheckNone ( PyObject pyObj ) : object
GetArgs ( object inargs, PyTuple &args, PyDict &kwargs ) : void

메소드 상세

AsManagedObject() 공개 메소드

AsManagedObject Method
Return a managed object of the given type, based on the value of the Python object.
public AsManagedObject ( Type t ) : object
t System.Type
리턴 object

DelAttr() 공개 메소드

DelAttr Method
Delete the named attribute of the Python object, where name is a PyObject wrapping a Python string or unicode object. This method throws a PythonException if the attribute set fails.
public DelAttr ( PyObject name ) : void
name PyObject
리턴 void

DelAttr() 공개 메소드

DelAttr Method
Delete the named attribute of the Python object. This method throws a PythonException if the attribute set fails.
public DelAttr ( string name ) : void
name string
리턴 void

DelItem() 공개 메소드

DelItem Method
For objects that support the Python sequence or mapping protocols, delete the item at the given object index. This method raises a PythonException if the delete operation fails.
public DelItem ( PyObject key ) : void
key PyObject
리턴 void

DelItem() 공개 메소드

DelItem Method
For objects that support the Python sequence or mapping protocols, delete the item at the given numeric index. This method raises a PythonException if the delete operation fails.
public DelItem ( int index ) : void
index int
리턴 void

DelItem() 공개 메소드

DelItem Method
For objects that support the Python sequence or mapping protocols, delete the item at the given string index. This method raises a PythonException if the delete operation fails.
public DelItem ( string key ) : void
key string
리턴 void

Dir() 공개 메소드

Dir Method
Return a list of the names of the attributes of the object. This is equivalent to the Python expression "dir(object)".
public Dir ( ) : PyList
리턴 PyList

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

Dispose() 보호된 메소드

Dispose Method
The Dispose method provides a way to explicitly release the Python object represented by a PyObject instance. It is a good idea to call Dispose on PyObjects that wrap resources that are limited or need strict lifetime control. Otherwise, references to Python objects will not be released until a managed garbage collection occurs.
protected Dispose ( bool disposing ) : void
disposing bool
리턴 void

Equals() 공개 메소드

Equals Method
Return true if this object is equal to the given object. This method is based on Python equality semantics.
public Equals ( object o ) : bool
o object
리턴 bool

FromManagedObject() 공개 정적인 메소드

FromManagedObject Method
Given an arbitrary managed object, return a Python instance that reflects the managed object.
public static FromManagedObject ( object ob ) : PyObject
ob object
리턴 PyObject

GetAttr() 공개 메소드

GetAttr Method
Returns the named attribute of the Python object or raises a PythonException if the attribute access fails. The name argument is a PyObject wrapping a Python string or unicode object.
public GetAttr ( PyObject name ) : PyObject
name PyObject
리턴 PyObject

GetAttr() 공개 메소드

GetAttr Method
Returns the named attribute of the Python object, or the given default object if the attribute access fails. The name argument is a PyObject wrapping a Python string or unicode object.
public GetAttr ( PyObject name, PyObject _default ) : PyObject
name PyObject
_default PyObject
리턴 PyObject

GetAttr() 공개 메소드

GetAttr Method
Returns the named attribute of the Python object, or raises a PythonException if the attribute access fails.
public GetAttr ( string name ) : PyObject
name string
리턴 PyObject

GetAttr() 공개 메소드

GetAttr Method
Returns the named attribute of the Python object, or the given default object if the attribute access fails.
public GetAttr ( string name, PyObject _default ) : PyObject
name string
_default PyObject
리턴 PyObject

GetEnumerator() 공개 메소드

GetEnumerator Method
Return a new PyIter object for the object. This allows any iterable python object to be iterated over in C#. A PythonException will be raised if the object is not iterable.
public GetEnumerator ( ) : IEnumerator
리턴 IEnumerator

GetHashCode() 공개 메소드

GetHashCode Method
Return a hashcode based on the Python object. This returns the hash as computed by Python, equivalent to the Python expression "hash(obj)".
public GetHashCode ( ) : int
리턴 int

GetItem() 공개 메소드

GetItem Method
For objects that support the Python sequence or mapping protocols, return the item at the given object index. This method raises a PythonException if the indexing operation fails.
public GetItem ( PyObject key ) : PyObject
key PyObject
리턴 PyObject

GetItem() 공개 메소드

GetItem Method
For objects that support the Python sequence or mapping protocols, return the item at the given numeric index. This method raises a PythonException if the indexing operation fails.
public GetItem ( int index ) : PyObject
index int
리턴 PyObject

GetItem() 공개 메소드

GetItem Method
For objects that support the Python sequence or mapping protocols, return the item at the given string index. This method raises a PythonException if the indexing operation fails.
public GetItem ( string key ) : PyObject
key string
리턴 PyObject

GetIterator() 공개 메소드

GetIterator Method
Return a new (Python) iterator for the object. This is equivalent to the Python expression "iter(object)". A PythonException will be raised if the object cannot be iterated.
public GetIterator ( ) : PyObject
리턴 PyObject

GetPythonType() 공개 메소드

GetPythonType Method
Returns the Python type of the object. This method is equivalent to the Python expression: type(object).
public GetPythonType ( ) : PyObject
리턴 PyObject

HasAttr() 공개 메소드

HasAttr Method
Returns true if the object has an attribute with the given name, where name is a PyObject wrapping a string or unicode object.
public HasAttr ( PyObject name ) : bool
name PyObject
리턴 bool

HasAttr() 공개 메소드

HasAttr Method
Returns true if the object has an attribute with the given name.
public HasAttr ( string name ) : bool
name string
리턴 bool

Invoke() 공개 메소드

Invoke Method
Invoke the callable object with the given arguments, passed as a PyObject[]. A PythonException is raised if the invokation fails.
public Invoke ( ) : PyObject
리턴 PyObject

Invoke() 공개 메소드

Invoke Method
Invoke the callable object with the given positional and keyword arguments. A PythonException is raised if the invokation fails.
public Invoke ( PyObject args, PyDict kw ) : PyObject
args PyObject
kw PyDict
리턴 PyObject

Invoke() 공개 메소드

Invoke Method
Invoke the callable object with the given arguments, passed as a Python tuple. A PythonException is raised if the invokation fails.
public Invoke ( PyTuple args ) : PyObject
args PyTuple
리턴 PyObject

Invoke() 공개 메소드

Invoke Method
Invoke the callable object with the given positional and keyword arguments. A PythonException is raised if the invokation fails.
public Invoke ( PyTuple args, PyDict kw ) : PyObject
args PyTuple
kw PyDict
리턴 PyObject

InvokeMethod() 공개 메소드

InvokeMethod Method
Invoke the named method of the object with the given arguments. A PythonException is raised if the invokation is unsuccessful.
public InvokeMethod ( string name ) : PyObject
name string
리턴 PyObject

InvokeMethod() 공개 메소드

InvokeMethod Method
Invoke the named method of the object with the given arguments and keyword arguments. Keyword args are passed as a PyDict object. A PythonException is raised if the invokation is unsuccessful.
public InvokeMethod ( string name, PyObject args, PyDict kw ) : PyObject
name string
args PyObject
kw PyDict
리턴 PyObject

InvokeMethod() 공개 메소드

InvokeMethod Method
Invoke the named method of the object with the given arguments. A PythonException is raised if the invokation is unsuccessful.
public InvokeMethod ( string name, PyTuple args ) : PyObject
name string
args PyTuple
리턴 PyObject

InvokeMethod() 공개 메소드

InvokeMethod Method
Invoke the named method of the object with the given arguments and keyword arguments. Keyword args are passed as a PyDict object. A PythonException is raised if the invokation is unsuccessful.
public InvokeMethod ( string name, PyTuple args, PyDict kw ) : PyObject
name string
args PyTuple
kw PyDict
리턴 PyObject

IsCallable() 공개 메소드

IsCallable Method
Returns true if the object is a callable object. This method always succeeds.
public IsCallable ( ) : bool
리턴 bool

IsInstance() 공개 메소드

IsInstance Method
Return true if the object is an instance of the given Python type or class. This method always succeeds.
public IsInstance ( PyObject typeOrClass ) : bool
typeOrClass PyObject
리턴 bool

IsIterable() 공개 메소드

IsIterable Method
Returns true if the object is iterable object. This method always succeeds.
public IsIterable ( ) : bool
리턴 bool

IsSubclass() 공개 메소드

IsSubclass Method
Return true if the object is identical to or derived from the given Python type or class. This method always succeeds.
public IsSubclass ( PyObject typeOrClass ) : bool
typeOrClass PyObject
리턴 bool

IsTrue() 공개 메소드

IsTrue Method
Return true if the object is true according to Python semantics. This method always succeeds.
public IsTrue ( ) : bool
리턴 bool

Length() 공개 메소드

Length Method
Returns the length for objects that support the Python sequence protocol, or 0 if the object does not support the protocol.
public Length ( ) : int
리턴 int

PyObject() 보호된 메소드

protected PyObject ( ) : System
리턴 System

PyObject() 공개 메소드

PyObject Constructor
Creates a new PyObject from an IntPtr object reference. Note that the PyObject instance assumes ownership of the object reference and the reference will be DECREFed when the PyObject is garbage collected or explicitly disposed.
public PyObject ( IntPtr ptr ) : System
ptr System.IntPtr
리턴 System

Repr() 공개 메소드

Repr Method
Return a string representation of the object. This method is the managed equivalent of the Python expression "repr(object)".
public Repr ( ) : string
리턴 string

SetAttr() 공개 메소드

SetAttr Method
Set an attribute of the object with the given name and value, where the name is a Python string or unicode object. This method throws a PythonException if the attribute set fails.
public SetAttr ( PyObject name, PyObject value ) : void
name PyObject
value PyObject
리턴 void

SetAttr() 공개 메소드

SetAttr Method
Set an attribute of the object with the given name and value. This method throws a PythonException if the attribute set fails.
public SetAttr ( string name, PyObject value ) : void
name string
value PyObject
리턴 void

SetItem() 공개 메소드

SetItem Method
For objects that support the Python sequence or mapping protocols, set the item at the given object index to the given value. This method raises a PythonException if the set operation fails.
public SetItem ( PyObject key, PyObject value ) : void
key PyObject
value PyObject
리턴 void

SetItem() 공개 메소드

SetItem Method
For objects that support the Python sequence or mapping protocols, set the item at the given numeric index to the given value. This method raises a PythonException if the set operation fails.
public SetItem ( int index, PyObject value ) : void
index int
value PyObject
리턴 void

SetItem() 공개 메소드

SetItem Method
For objects that support the Python sequence or mapping protocols, set the item at the given string index to the given value. This method raises a PythonException if the set operation fails.
public SetItem ( string key, PyObject value ) : void
key string
value PyObject
리턴 void

ToString() 공개 메소드

ToString Method
Return the string representation of the object. This method is the managed equivalent of the Python expression "str(object)".
public ToString ( ) : string
리턴 string

TryBinaryOperation() 공개 메소드

public TryBinaryOperation ( BinaryOperationBinder binder, Object arg, Object &result ) : bool
binder BinaryOperationBinder
arg Object
result Object
리턴 bool

TryConvert() 공개 메소드

public TryConvert ( ConvertBinder binder, object &result ) : bool
binder ConvertBinder
result object
리턴 bool

TryGetMember() 공개 메소드

public TryGetMember ( GetMemberBinder binder, object &result ) : bool
binder GetMemberBinder
result object
리턴 bool

TryInvoke() 공개 메소드

public TryInvoke ( InvokeBinder binder, object args, object &result ) : bool
binder InvokeBinder
args object
result object
리턴 bool

TryInvokeMember() 공개 메소드

public TryInvokeMember ( InvokeMemberBinder binder, object args, object &result ) : bool
binder InvokeMemberBinder
args object
result object
리턴 bool

TrySetMember() 공개 메소드

public TrySetMember ( SetMemberBinder binder, object value ) : bool
binder SetMemberBinder
value object
리턴 bool

TryUnaryOperation() 공개 메소드

public TryUnaryOperation ( UnaryOperationBinder binder, Object &result ) : bool
binder UnaryOperationBinder
result Object
리턴 bool

TypeCheck() 공개 메소드

TypeCheck Method
Returns true if the object o is of type typeOrClass or a subtype of typeOrClass.
public TypeCheck ( PyObject typeOrClass ) : bool
typeOrClass PyObject
리턴 bool

this() 공개 메소드

PyObject Indexer
Provides a shorthand for the object versions of the GetItem and SetItem methods.
public this ( PyObject key ) : PyObject
key PyObject
리턴 PyObject

this() 공개 메소드

Numeric Indexer
Provides a shorthand for the numeric versions of the GetItem and SetItem methods.
public this ( int index ) : PyObject
index int
리턴 PyObject

this() 공개 메소드

String Indexer
Provides a shorthand for the string versions of the GetItem and SetItem methods.
public this ( string key ) : PyObject
key string
리턴 PyObject

프로퍼티 상세

obj 보호되어 있는 프로퍼티

protected IntPtr obj
리턴 IntPtr