Slices time complexity
Christian Gollwitzer
auriocus at gmx.de
Wed May 20 17:54:48 EDT 2015
Am 19.05.15 um 15:44 schrieb Steven D'Aprano:
> Variables are not first class values in C. (I assume you meant *values*
> rather than "objects", on account of C not being an OOP language.) There is
> no way, for example, to set x to *the variable y* in either C or Python. If
> you could, that would imply something like this:
>
> y = 42 # regular assignment
> x ::= y # set x to be the variable y, not the value of y
> assert x == y # naturally, since x and y are now two different
> # names for the same variable
> x = 23 # regular assignment
> assert y == 23 # since y is just another name for x
In C++, this is possible:
int y=42;
int &x = y;
assert(x==y);
x=23;
assert(x==y);
.... but, admittedly, you can't reassign x.
Christian
More information about the Python-list
mailing list