On Sat, May 21, 2016 at 2:47 PM, <jf...@ms4.hinet.net> wrote: > It's amazing the "tool" is so simple. Actually I feel a little embarrassed > that I do know every statements in it but just no idea of combining them > together. Thanks a lot, Chris. >
It's a pretty complicated tool, actually - but you're using it in a simple way here. If you're curious, you can poke around in the CPython sources to track down the data structures involved - as you noted, the refcount is at the beginning of every object, and after that you'll find some neat info like a pointer to its type. You can even change some of this stuff, but be aware that you can EASILY segfault Python like this :D ChrisA -- https://mail.python.org/mailman/listinfo/python-list