开发者

submodules in ironpython

开发者 https://www.devze.com 2023-01-19 07:01 出处:网络
While I\'m familiar with making .net assemblies with the PythonModule assembly attribute, I\'m a little curious as to how you could make submodules.Would this be a class within a class?i.e: if I have

While I'm familiar with making .net assemblies with the PythonModule assembly attribute, I'm a little curious as to how you could make submodules. Would this be a class within a class? i.e: if I have a class defined as an IronPython module suc开发者_Python百科h as:

[assembly: PythonModule(mymodule),typeof(namespace.mymodule)]

How could I define a submodule within mymodule, so that from python I could do:

import mymodule.submodule

Thanks in advance!


It's interesting, there's actually no support for this at all right now. For the most part this has been used to implement built-in modules that exist in CPython and there's simply been no need for submodules yet. You could have a nested static class in the class used for the module but it wouldn't import as a module - it'd show up as a type object in Python.

0

精彩评论

暂无评论...
验证码 换一张
取 消