submodules in ironpython
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.
精彩评论