tags:

views:

18

answers:

1

Hey everyone,

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 such 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!

+3  A: 

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.

Dino Viehland
Hmm. I suppose that's not necessarily a show-stopper, since import statements seem to work on nested classes, and invoking methods on them is functionally identical to invoking methods on submodules. Thanks for your response!
JustOnePixel