You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alias and aliased are limited to use inside classes due them being descriptors
Describe the solution you'd like
I'd like to see either another decorator or descriptor that can be used at the module level.
Solutions that I see at the moment, none of which seem ideal:
a dummy class that extends module and holds the aliases
problem is, when a module is imported, it would not return the dummy class
a decorator that actually copies by value instead of reference
the current alias implementation only adds a new attribute to a class which references the same thing
Describe alternatives you've considered
I've tried using the existing descriptors and they do not work, I cannot attach the alias to an already existing module
due to them being immutable, and __set_name__ is not called when assigning descriptors outside of a class.
__get__ is also not called when accessing a module's attribute that defines it.
Also... can just do:
defmethod():
return'test'my_alias=method
The text was updated successfully, but these errors were encountered:
assigns my_alias to reference the same function as method, however changes to the method name in the module won't be reflected in my_alias which would be expected by an implementation that adds this feature.
It might not be possible to implement this in the same way that we have the current aliases.
However, maybe we can at least define aliased functions and aliass for them inside classes.
Is your feature request related to a problem?
alias
andaliased
are limited to use inside classes due them being descriptorsDescribe the solution you'd like
I'd like to see either another decorator or descriptor that can be used at the module level.
Solutions that I see at the moment, none of which seem ideal:
module
and holds the aliasesalias
implementation only adds a new attribute to a class which references the same thingDescribe alternatives you've considered
I've tried using the existing descriptors and they do not work, I cannot attach the alias to an already existing module
due to them being immutable, and
__set_name__
is not called when assigning descriptors outside of a class.__get__
is also not called when accessing a module's attribute that defines it.Also... can just do:
The text was updated successfully, but these errors were encountered: