forbiddenfruit icon indicating copy to clipboard operation
forbiddenfruit copied to clipboard

Patch built-in python objects

Results 39 forbiddenfruit issues
Sort by recently updated
recently updated
newest added

How to make the additional function can be autocompleted in VS Code?

Here's a quick session on Windows 11 with Python 3.10 (from the Windows app "store"): ``` PS C:\Users\user> .\python3\Scripts\python.exe Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit...

``` Beware: reverse() only deletes attributes. If you curse()'d to replace a pre-existing attribute, reverse() won't re-install the existing attribute. ``` Any workarounds for this?

I don't have a MacOS system to check anymore, but when I was last using a Mac at work, I tested some monkeypatching of `object`, and I noticed an interesting...

this is the 2nd, the 1st i messed it up by sending it before debugging, anyways, support for `__iter__`, `__next__`, `__hash__`

I want to modify `__add__` magic function for `str`, but somehow it is not working. Refer to a previous issue #21, the code below is working fine: ```python from forbiddenfruit...

Python 3.8.3 Code - ```py from forbiddenfruit import curse def __iter__(self): return iter(range(self)) curse(int, "__iter__", __iter__) ``` Output - ``` forbiddenfruit/__init__.py", line 329, in _curse_special tp_as_name, impl_method = override_dict[attr] KeyError:...

curse(str, '__eq__', str.__ne__) fails with: ... ``` File ".../python3.6/site-packages/forbiddenfruit/__init__.py", line 425, in curse _curse_special(klass, attr, value) File ".../python3.6/site-packages/forbiddenfruit/__init__.py", line 332, in _curse_special tp_as_name, impl_method = override_dict[attr] KeyError: '__eq__' ``` Also...

After cursing `np.ndarray.__add__` , even if I re-curse after storing the original in a variable, the `__radd__` method breaks. Way to reproduce ``` import numpy as np import forbiddenfruit orig...