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
so each of the ifs will be broken into their own method, I think this will help with maintenance.
Each of those methods should take a dict that maps the type to function that will create the string value from that type, so, for example, for module it would be by default:
{
"MODULE": self._str_val
}
But you could pass in a dict that changes that mapping so you could short circuit the generation and basically say all modules should just render with repr on down the line, the reason for this is to allow properties to be printed on modules, right now I just print the name because pout.v(sys) will choke if it tries to print out the property values, I think there is circular recursion with sys.modules.
The text was updated successfully, but these errors were encountered:
instead of a function I think maybe it should be a class with a __repr__ method. And all those classes should live in like a value module, and value would have a wrap function, the wrap function would go through all the classes (I guess I would need to set the order?) and pass in the value to be wrapped and then call the is_valid method, which would basically be the statement in the current if/elif block.
pout should also make it easy to wrap something and then turn stuff off, so if I wrapped an instance of my custom class, I could tell the value.InstanceWrapper to not display dicts and things like that so I could more easily customize the output, this would really help sometimes when I dealing with large datasets while trying to figure out how to interact with the 3rd party api.
so right now
_str_val
is just a giant if/elif/else, but I would like to change it so it gets the type and then basically takes that type and does:so each of the ifs will be broken into their own method, I think this will help with maintenance.
Each of those methods should take a dict that maps the type to function that will create the string value from that type, so, for example, for module it would be by default:
But you could pass in a dict that changes that mapping so you could short circuit the generation and basically say all modules should just render with
repr
on down the line, the reason for this is to allow properties to be printed on modules, right now I just print the name becausepout.v(sys)
will choke if it tries to print out the property values, I think there is circular recursion withsys.modules
.The text was updated successfully, but these errors were encountered: