-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
I was playing around with different ways to
simulate what atexit does and found this very interesting
use-case with weak references.
import weakref
class C: pass
def goodbye(param):
print 'Bye.',param
x=weakref.ref(C, goodbye)
if
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tuesday 10 September 2013 11:30 AM, Anand B Pillai wrote:
Don't advise anyone to use this code - it is just to illustrate
the one of the ways in which weak references can be used. In
general it is better not to rely on the order of gc in your
On Tue, Sep 10, 2013 at 11:43 AM, Anand B Pillai
anandpil...@letterboxes.org wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tuesday 10 September 2013 11:30 AM, Anand B Pillai wrote:
Don't advise anyone to use this code - it is just to illustrate
the one of the ways in which
Anand Chitipothu anandol...@gmail.com writes:
[...]
You can also achieve the same using __del__.
class Foo:
def __del__(self):
print on exit
foo = Foo()
if __name__ == '__main__':
print 3+4
print 8+9
This whole business is kind of surreptitious.
The PyODE
On Tue, Sep 10, 2013 at 12:13 PM, Noufal Ibrahim nou...@nibrahim.net.inwrote:
[...]
This whole business is kind of surreptitious.
The PyODE library had a world object which can hold multiple
geometries in it. Once you add it to the world, you expect it to keep
track of the geometries.
Anand Chitipothu anandol...@gmail.com writes:
[...]
Isn't that the job of PyODE library to keep track objects in the world by
adding them to a list or something?
I'd expect so.
If I say something like world.add_geometry(obj), it should keep track of
it. But for some obscure reason, it