Skip to content

How do I pass classes to Python? #859

@lostmsu

Description

@lostmsu

Environment

  • Pythonnet version: 2.4.0
  • Python version: 3.6
  • Operating System: Win 10 x64

Details

From Python it is possible to do

from System import Progress, Int32

int_progress = Progress[Int32]

Is it possible from C# to obtain a PyObject, representing the same object as int_progress above without resorting to Eval?

typeof(Progress<int>).ToPython()

will produce a PyObject pointing to System.Type (which, IMHO, is by design)

But I need a PyObject, which when passed to Python can be used in place of int_progress above, e.g., for example, to call a constructor: int_progress()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions