Jaymon / pout

Python pretty print on steroids
MIT License
29 stars 0 forks source link

Order of Inspect checks #71

Closed Jaymon closed 2 years ago

Jaymon commented 2 years ago

In order to add a new Value you have to add a method in value.Inspect and then add a subclass of value.Value, then you have to call your new Inspect method in the Inspect.typename property because certain methods need to be called before others (eg, is_path needs to be called before is_object because otherwise a pathlib.Path instance would just be treated like a vanilla object.

I think I can infer the order by looking at the parent classes, so if a child class inherits from another child class, then the former would be called before the latter. So if you had 5 classes that all extended ObjectValue they would all be called before ObjectValue.

I would just need to move the checking methods onto the Value object, and then have something that organizes the order and calls them, so to add a new value you would just need to add a Value subclass