Wednesday, 28 August 2013

Unique representations of Python objects

Unique representations of Python objects

Let C be a Python class and assume that the constructor of C takes an
integer as argument.
Consider now the instructions
x = C(0)
y = C(0)
The default behavior of Python implies that x and y occupy two different
place in the memory.
It is possible to force x and y to share the same place in memory ?
I would be very happy if some Python decorator makes the job.

No comments:

Post a Comment