dfply
dfply copied to clipboard
dfply.base.Intention __getattr__ breaks typical Python built-in attribute behavior
The implementation of __getattr__ in dfply.base.Intention breaks access of built-in Python attributes like __qualname__, which are often used in systems doing object introspection.
Any attribute accessed on instances of Intention cause a new Intention object to be returned... but this breaks assumptions for built-in methods like __qualname__ and __str__ that expect a str to be returned and not an instance of Intention.
See: https://github.com/kieferk/dfply/blob/master/dfply/base.py#L73-L75
class Intention(object):
...
def __getattr__(self, attribute):
return Intention(lambda x: getattr(self.function(x), attribute),
invert=self.inverted)