On Tuesday, 7 October 2025 at 15:54:22 UTC-7 mathzeta2 wrote:

When handling inheritance, there is a disadvantage to defining an alias 
with `bar = foo`.

[...] 

In some places in Sage an alias `baz` will be defined as 

def baz(self): 
return self.foo() 

and a short doc that says it is an alias, instead of the better solution 
of having the full docstring of foo() with a prefix that tells this is 
an alias. 

 
In fact, this already points to an unintended complication with modifying 
the output of "dir":  Someone might be looking to subclass something and 
install new functionality. They check "dir" of the ancestor and find that 
the name they were thinking of to be unused, so they happily put their own 
function in. But as it happens, they have now overwritten an alias that was 
there for legacy reasons and now their subclassed objects fail to behave 
properly in other legacy contexts where other routines are relying on the 
aliases that are now overridden with different functionality. This could 
even lead to silent wrong results

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/5cb7ce13-6639-46d8-9eaa-7ac4a8a752a1n%40googlegroups.com.

Reply via email to