グローバル変数

次のグローバル変数はグローバルに使用できます。

  • グローバルな Python インターフェイス。

    Python モジュールをインポートし、 Pythonグローバル変数を介して Python の組み込み型と関数にアクセスできます。

    import Python
    // Import modules.
    let os = Python.import("os")
    let np = Python.import("numpy")
    
    // Use builtin types and functions.
    let list: PythonObject = [1, 2, 3]
    print(Python.len(list)) // Prints 3.
    print(Python.type(list) == Python.list) // Prints true.
    

    宣言

    public let Python: PythonInterface