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
{{ message }}
Repository navigation
Time subclasses and using them to initialize Times #10654
Time.__new__ has special treatment for Time instances, essentially passing them through with perhaps a scale change. It turned out this included TimeDelta, so that Time(TimeDelta(...)) returned a TimeDelta instance, which was surprising and caused #10651. In #10652, the bug was fixed by restricting the special case to instances of the class proper. But as @taldcroftnotes, in general one would like for Time(TimeSubClass(...)) to work and to return a Time instance. It would be good to allow that.
Part of the problem is that TimeDelta should probably not be a subclass of Time - indeed, as noted in #6828 it shares methods such as .now() and .light_travel_time() that really make no sense. In #6828, it was suggested a better scheme might be to have both Time and TimeDelta inherit from a common TimeBase.
Activity
pllim commentedon Aug 14, 2020
So, is this "enhancement" or "bug"? 😅