rename a class instantiated
-
when I instantiate a class, is it possible to rename the "class instantiated" with another name?
class MyClass() def __init__(self): .... def method_1() .... def method_2() .... clasaName = MyClass () className.__name__ = "apple" #in order to have as a final result apple.method_1()
I have tried the code above but without positive results.
Thanks in advance
Fausto -
when I instantiate a class, is it possible to rename the "class instantiated" with another name?
class MyClass() def __init__(self): .... def method_1() .... def method_2() .... clasaName = MyClass () className.__name__ = "apple" #in order to have as a final result apple.method_1()
I have tried the code above but without positive results.
Thanks in advance
Fausto -
when I instantiate a class, is it possible to rename the "class instantiated" with another name?
class MyClass() def __init__(self): .... def method_1() .... def method_2() .... clasaName = MyClass () className.__name__ = "apple" #in order to have as a final result apple.method_1()
I have tried the code above but without positive results.
Thanks in advance
Fausto -
when I instantiate a class, is it possible to rename the "class instantiated" with another name?
class MyClass() def __init__(self): .... def method_1() .... def method_2() .... clasaName = MyClass () className.__name__ = "apple" #in order to have as a final result apple.method_1()
I have tried the code above but without positive results.
Thanks in advance
Fausto@FaTr I suspect that what you try to do is actually not a class re-naming but class inheritance...
So, could you please explain a bit more what is your ultimate goal that you would like to achieve this way? -