Package pycocoa :: Module runtime :: Class ObjCInstance
[frames] | no frames]

Class ObjCInstance

object --+    
         |    
  ObjCBase --+
             |
            ObjCInstance
Known Subclasses:

Python wrapper for an ObjC instance.

Instance Methods
 
__getattr__(self, name)
Returns a callable method object with the given name.
 
__str__(self)
str(x)
 
release(self)
Garbage collect this instance.
 
set_ivar(self, name, value, ctype=None)
Set an instance variable (ivar) to the given value.

Inherited from ObjCBase: __repr__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Static Methods
a new object with type S, a subtype of T
__new__(cls, objc_ptr)
New ObjCInstance or return a previously created one.
Properties
  objc_class
Get this instance' ObjC class (ObjCClass).
  objc_classname
Get the name of this instance' ObjC class (str).
  objc_description
Get this instance' ObjC description (str).
  ptr
Get this instance' equivalent ObjC instance (Id_t).
  Type
Get the Python Type for this instance' ObjC class (class).

Inherited from object: __class__

Method Details

__new__(cls, objc_ptr)
Static Method

 

New ObjCInstance or return a previously created one.

Parameters:
  • objc_ptr - The ObjC class Id_t.
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

release(self)

 

Garbage collect this instance.

Note: May result in Python memory errors, aborts and/or segfaults. Run with python3 -X faulthandler ... the get the Python traceback.

set_ivar(self, name, value, ctype=None)

 

Set an instance variable (ivar) to the given value.

Parameters:
  • name - Name of the ivar (str).
  • value - Value for the ivar (any).
  • ctype - The type code of the ivar (ctypes).
Returns:
The ivar (Ivar_t).
Raises:
  • ArgumentError - Invalid name, value or ctype.
  • TypeError - Invalid name, value or ctype type.

Property Details

objc_class

Get this instance' ObjC class (ObjCClass).

Get Method:
objc_class(self) - Get this instance' ObjC class (ObjCClass).

objc_classname

Get the name of this instance' ObjC class (str).

Get Method:
objc_classname(self) - Get the name of this instance' ObjC class (str).

objc_description

Get this instance' ObjC description (str).

Get Method:
objc_description(self) - Get this instance' ObjC description (str).

ptr

Get this instance' equivalent ObjC instance (Id_t).

Get Method:
ptr(self) - Get this instance' equivalent ObjC instance (Id_t).

Type

Get the Python Type for this instance' ObjC class (class).

Get Method:
Type(self) - Get the Python Type for this instance' ObjC class (class).