Repository navigation
Replies: 2 comments 2 replies
|
So almost like a factory context? I tentatively like this idea though it's starting to sound like java. The key will be to make the signature make sense. |
0 replies
|
So would this be something like: with montepy.read_input("foo") as parent_mp:
cell = parent_mp.Cell()
assert cell in parent_mp
with parent_mp.SubFile("bar") as subfile:
cell = subfile.Cell()
assert cell in subfile
assert cell in parent_mpThis seems a bit messy to me at first blush, but I think there's something there. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I brought up the idea of using a context manager for sub input files in #143.
More broadly, context managers could be used to build problems more lazily. Newly created cells could be automatically assigned parameters (universe, importance, etc.), numbered, and added to the problem with. Parts of a problem input could be formatted differently, as suggested in #103.
All reactions