Open researcher175 opened 8 months ago
I'm removing the bug label, this isn't a bug, inlining __new__
currently isn't supported so it's a new feature.
It should be possible to implement, inlining classmethods already mostly works and inlining __new__
is similar to inlining code that looks like so:
unicode = str
class MyClass(unicode):
def __new__(cls, string):
return super(MyClass, cls).__new__(cls, string)
def __init__(self, string):
self.value = string
instance = MyClass.__new__(...)
There are some tweaking needing to fix the super()
call, but currently inlining classmethod don't fix that either, so that can be done together with that.
Python’s instantiation process starts with a call to the class constructor, which triggers the instance creator, __new__(), to create a new empty object. The process continues with the instance initializer, __init__(), which takes the constructor’s arguments to initialize the newly created object. Rope allows applying the Inline Method refactoring to the __new__() method.
Steps to reproduce the behavior: