Closed henryiii closed 4 years ago
This could be manually fixed on a case-by-case basis, but there are enough warts with the current system I'd like to propose a replacement:
Add a new Hist.new
class object. That object is the Hist proxy. Calling a storage returns a real Hist instance. Maybe a few (at least fill) methods could be included too that would use the default storage. This would keep the namespaces cleaner, and should be a much simpler implementation.
So:
h: Hist = Hist.new.Reg(3,1,2).Log(10,1,10).Double()
h: Hist = Hist.new.Reg(3,1,2).Log(10,1,10).fill(...) # Fill could automatically create a default storage and start filling it
Tab completion and static typers (mypy, PyCharm, etc) would be helpful in guiding a user to do the right thing; trading a little magic for type safety.
@LovelyBuggies thoughts?
I think it makes sense. Do you want to add this change to v2.0.0?
Btw, the CHANGELOG looks humble, we'd better make it more clearly.
Yes, this is a blocker - having >>> Hist.Reg(10,0,1)
broken on the REPL is not something we can allow in 2.0.
The CHANGELOG starts at 2.0 final, so it will not really have any entries till we release 2.0.
Though I guess you could have it go for the whole life of the project; 2.0 would simply be a list of the current features, and the few 1.0 releases were just the command line tiny program that existed.
If you do
repr(Hist.Reg(10,0,1))
, that breaks because dunder methods are looked up on the class, not the object.