You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been reading the documentation (and source) for Randomized and add_rand()
It seems like add_rand() could create an attribute if it is not found in the object, and perhaps initialise it to the first element in the domain list.
It seems like this would reduce boilerplate in common code where currently the examples require writing self.x = some_dummy_value before add_rand("x", ...)
The text was updated successfully, but these errors were encountered:
Hi @jonpovey
Not sure if I like it - you do not need to randomize an object to use it. I agree it is an additional code needed, but also readability is better. I don't like being too pythonic by reducing amount of code, paying the clarity price.
I would agree to add this feature if there are more votes.
I have been reading the documentation (and source) for
Randomized
andadd_rand()
It seems like
add_rand()
could create an attribute if it is not found in the object, and perhaps initialise it to the first element in the domain list.It seems like this would reduce boilerplate in common code where currently the examples require writing
self.x = some_dummy_value
beforeadd_rand("x", ...)
The text was updated successfully, but these errors were encountered: