DEV Community

Discussion on: [Python-Ideas] Link: Bidirectional Aliasing in Python

Collapse
 
vedgar profile image
Vedran Čačić

I think in all of those, except maybe the "simplify aliasing" example, '=' does more correct thing than your linking. And it is already supported in Python. For "simplify aliasing", as you said, we already have properties (which are arguably better since you can add validation in .setter).

For example, in your "change non-intuitive naming to a better one", I do it all the time with assignment. And it works according to my expectations. Especially for methods (which is 95% of cases:), since you never really reassign methods after you define them.

Collapse
 
circleoncircles profile image
Nutchanon Ninyawee

I could not agree more with you. Anyway, I added more clarification with examples here. After go thru that, if you still think that is the case. Then, I think it is actually the case.

Collapse
 
vedgar profile image
Vedran Čačić • Edited

Yup, mostly (multilingual coding is an exception, but I strongly believe this is better handled through external tools, not Python language itself). The ones when I don't are the ones where even the link wouldn't help you. For example, you seem to think that "freeing the memory" for an object happens immediately after you del all the names for it.

First, it doesn't have to be, and second, even if it did, it still wouldn't help you much because you can't know, especially with complex frameworks like jupyter, who else "up the chain" and in what place holds a reference to your object. If you really want to explore such ideas, weakref (which is built specifically for that) might be much better choice.