[Python-ideas] aliasing

Peio Borthelle peio.borthelle at gmail.com
Tue Aug 30 15:20:49 CEST 2011

First, thank you to all the development community for this fabulous language (I'm french so my english is a bit...bad and basic). I'm quite new to programming and python is my first language.
As beginner I had problems to deal with all aliasing stuff (in-place changes or not...). So my suggestion is perhaps not to change this (altough I find it a bit opposite to the python sense...) but to have a real aliasing fonction:
>>> a = 2
>>> b = alias("a")
>>> a = 'foo'
>>> b
b is always a, it doesn't point to the same data, it points to the pointer a itself ! The arg is a string because otherwise the interpreter would give the value as arg, not the pointer.
It could also be more complexe:
>>> a = 3
>>> b = alias("(a*3)+2")
>>> b
>>> a = 5
>>> b
Here I alias an expression (that's also why the arg must be a string). But I don't know if this last example is something good because a would have to stay a number (or generate an exception by calling b).
If a is destroyed, then calling b would generate an exception...I don't have enough experience in python programming to really know how work the garbage collector, so I don't know if a could be destroyed by it.

This is the end of my suggestion (I hope it wasn't already proposed, else...).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110830/6fa9f9d4/attachment.html>

More information about the Python-ideas mailing list