Why doesn't the decorated method doesn't show up in NextTip(Pycharm)
from functools import wraps
def add_method(cls):
def decorator(func):
@wraps(func)
def wrapper(self, *args, **kwargs):
return func(self, *args, **kwargs)
setattr(cls, func.__name__, wrapper)
return func
return decorator
class Apple():
def __init__(self):
print("my apple")
def appletest(self):
print("apple test")
@add_method(Apple)
def mangotest(self):
print("mango test")
a = Apple()
a.appletest()
a.mangotest()
Output is fine,
my apple apple test mango test
Once I type a. I can see appletest but not mangotest as my tip. How can i achieve it in my editor ?