memestra
memestra copied to clipboard
Memestra doesn't work with methods
Was trying to write an example for the blogpost and got this:
import deprecated
@deprecated.deprecated('This function will be removed on Feb. 2100.')
def some_old_function(x, y):
return x + y
# You can also decorate a class or a method:
class SomeClass(object):
@deprecated.deprecated('kkkkk')
def some_old_method(self, x, y):
return x + y
@deprecated.deprecated('Use another class.')
class SomeOldClass(object):
pass
some_old_function(2, 3)
some_obj = SomeClass()
some_obj.some_old_method(4, 5)
SomeOldClass()
Everything is captured by memestra but some_obj.some_old_method(4, 5).
I checked our tests and we're actually not covering it at all. I think we forgot. Can help on this fix after this hectic week.
Well, there's a good reason we don't support it: when a method is accessed, we need to know the type of the object in order to determine which code gets executed.
Some things we can do:
- raise a warning because we don't know how to handle it.
- use type information, if any, to track variable types and thus resolve method calls
- assume that if a method is deprecated, all methods with the same name are deprecated
@SylvainCorlay any thoughts?