clarete / forbiddenfruit

Patch built-in python objects

Home Page:https://clarete.li/forbiddenfruit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

__invert__ operator not supported correctly

stephenbrodiewild opened this issue · comments

According to the official documentation the dunder method for the invert operator i.e. '~' should be __invert__ rather than __inv__ as currently implemented in init.py (line 267)

Apparently earlier versions of Python (2.7) has support for the __inv__ operator but version 3 only uses __invert__

Hi @stephenbrodiewild, thank you for creating the issue \o/
I didn't really investigate deeply, but it seems like this would be as simple as adding a new entry for invert around this line: https://github.com/clarete/forbiddenfruit/blob/master/forbiddenfruit/__init__.py#L267.

Do you think you could make that change and see if that works? And if that works, would you be up to opening a Pull Request? :)

Thank you!

After merging #40 we might probably close this one! Thank you for reporting and fixing the issue, @stephenbrodiewild. Really appreciate it!