Replies: 3 comments 4 replies
-
Well, if we compare class Circle(ShapedComponent):
def __init__(
self,
name,
material,
Tinput,
Thot,
od,
id=0.0,
mult=1.0,
modArea=None,
isotopics=None,
mergeWith=None,
components=None,
): With class Helix(ShapedComponent):
def __init__(
self,
name,
material,
Tinput,
Thot,
od=None,
id=0.0,
mult=None,
axialPitch=None,
helixDiameter=None,
modArea=None,
isotopics=None,
mergeWith=None,
components=None,
): There are definitely some different initializers there. First, So, there are two approaches I can envision here:
|
Beta Was this translation helpful? Give feedback.
-
While I like the idea of improving the defaults to the >>> from armi.reactor.components.complexShapes import Helix
>>> h = Helix("test", "HT9", 322, 555)
>>>
>>> h = Helix("test", "HT9", 322)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __init__() missing 1 required positional argument: 'Thot'
>>>
>>> h = Helix("test", "HT9")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __init__() missing 2 required positional arguments: 'Tinput' and 'Thot'
>>>
>>> h = Helix("test", "HT9", 322, id=0.1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __init__() missing 1 required positional argument: 'Thot' The error messages look descriptive to me. How were you able to get that error?
|
Beta Was this translation helpful? Give feedback.
-
Okay, my current plan for the
My reasoning goes as follows:
The only risk I can see is that changing the above involves a slight change to the order of the |
Beta Was this translation helpful? Give feedback.
-
Typically when you construct a component, ARMI gives a good error message if you forget to supply a required dimension of the component:
But I noticed that when you construct a
Helix
component, if you accidentally forget to supply one of the dimensions of the component then the code gives a different, less useful error:I think the reason that the Helix doesn't give the good error message is because the
__init__
of theHelix
class supplies default values ofNone
for the required dimensions to the component constructor. Is there some good reason for supplying these defaults? Otherwise, I'm thinking we should take those away to improve the user experience.Beta Was this translation helpful? Give feedback.
All reactions