Is your feature request related to a problem? Please describe.
It's a little frustrating that if you call alias.attach on an instance variable, the object's class will be modified with the alias.
For instance:
import aliasing as aka
class Foo:
def method(self):
return "baz"
bar = aka.alias(alias_for="method", alias_name="bar")
f1 = Foo()
bar.attach(f1)
# prints "True"
print(f1.bar() == f1.method())
f2 = Foo()
# prints "True"
print(f2.bar() == f1.method())
Describe the solution you'd like
I'd like to see this behavior instead:
import aliasing as aka
class Foo:
def method(self):
return "baz"
bar = aka.alias(alias_for="method", alias_name="bar")
f1 = Foo()
bar.attach(f1)
# prints "True"
print(f1.bar() == f1.method())
f2 = Foo()
# raises AttributeError
print(f2.bar() == f1.method())
Is your feature request related to a problem? Please describe. It's a little frustrating that if you call
alias.attach
on an instance variable, the object's class will be modified with thealias
. For instance:Describe the solution you'd like I'd like to see this behavior instead: