Open john-science opened 3 years ago
Oh man, that's a bummer. It's been a while, but I threw together an example that I think works...
class Animal(Object):
name = Attribute()
age = Attribute()
def __init__(self, name, age):
self.name = name
self.age = age
# the subclass is serializable; however, it is not a direct subclass of Object, etc.
class Animal2(Animal):
def __init__(self, name, age):
Animal.__init__(self, name, age)
self.lossy = 'will not be written'
More importantly, this is a good feature to add. Please look into it if/when you can :-)! I believe Attribute
, or at least _Attribute
is inheritable. If you need help, or have questions, feel free to reach out. If you need to air grievances of the complexity involved in hacking Python system to do what yamlize does.... please refactor. There's either too many or too few layers of abstraction.
So, last week I was working on an armi ticket, and came up with a real need to hide data inside a
yamlize.object
, that wouldn't be written out to the final YAML. This should have been a small tweak, but ended up being rather hard to trickyamlize
to do.The solutions we came up with were:
yamlize.object
and delete it right before we.dump()
.hasattr
to look for it.So, we had a solution eventually, but we lost a lot of time on it. What would have really helped would be if Yamlize:
I suppose (1) above would be easier, but (2) would provide a lot more flexibility in the future.
I'd be happy to help implement a solution, if you that's amenable to you.