Python Mapping for Local Classes

On this page:

Mapped Python Class

A local Slice class is mapped to a Python class with the same name. For example:

Slice
module M
{
    local class Example
    {
        ...
    }
}

is mapped to the Python class Example:

Python
class Example(object):
    ...

LocalObject in Python

Like local interfaces, local Slice classes implicitly derive from LocalObject, which is mapped to the native object class in Python.

Mapping for Local Interface Inheritance in Python

A local Slice class can extend another local Slice class, and can implement one or more local Slice interfaces. Both extends and implements are mapped to class inheritance in Python. For example:

Slice
module M
{
    local interface A {}
    local interface B {}
    
    local class C implements A, B {}
    local class D extends C {}
}

is mapped to:

Python
class A(object):
    ...
class B(object):
    ...
class C(A, B):
    ...
class D(C):
    ...