Christian Heimes wrote:
eric.le.bi...@spectro.jussieu.fr wrote:
Hello,

Is there a way to easily build an object that behaves exactly like a
float, but whose value can be changed?  The goal is to maintain a list
[x, y,…] of these float-like objects, and to modify their value on the
fly (with something like x.value = 3.14) so that any expression like "x
+y" uses the new value.


Your approach doesn't follow the Python philosophy thus it's most likely
to fail. It is possible to implement a mutable float like object --
Python doesn't stop you from shooting yourself in the knee -- but please
don't harm yourself.

[snip]
The saying is actually "shooting yourself in the foot", but then that's
like what happens when you don't follow the Python philosophy! :-)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to