[Python-ideas] aliasing

Peio Borthelle peio.borthelle at gmail.com
Wed Aug 31 13:43:36 CEST 2011

Le 30 août 2011 à 15:51, Herman Sheremetyev a écrit :

> b = lambda: a
> b = lambda: a*3 + 2
> How's that? ;)

Great, I hadn't tought to the lambda fonction, and it is a solution... but it isn't quite what I proposed: here b is a fonction, you have to call it to have the number. If you want to use it in your code, e.g. two int variable must stay to the same value, you can't give a fonction as argument, and what I want to avoid is precisely to change both value one by one.
I misspoke something in my last message (and it wasn't also quite clear in my mind), I sould have written:
>>> a = 3
>>> b = Alias("a")  # Alias is a class (or data type?).
Where b is an Alias instance. I don't know anything in C language, so I don't know how works data types defining, but I imagine the Alias class as a normal variable wich's value changes dynamically. Is it technically possible ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110831/71716b03/attachment.html>

More information about the Python-ideas mailing list