[IronPython] How to get the list of objects created

Thane thane at magna-capital.com
Wed Sep 15 18:10:32 CEST 2004

In CPython you do the following:
Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on
Type "help", "copyright", "credits" or "license" for more information.
>>> X = 4
>>> Y = 42.6
>>> globals().values()
[<module '__builtin__' (built-in)>, '__main__', 42.600000000000001, None, 4]

** BUG  ALERT  **
But if you try to get the values() of the global dictionary in IronPython,
it will crash.

>>> X = 4
>>> Y = 6
>>> globals()
{'X':4, 'Y':6}
>>> g.values()

Fatal stack overflow error.

Also note that if you have a statement like:
>>> from System.Text import *

Your list of globals is going to be pretty big!

-----Original Message-----
From: users-ironpython.com-bounces at lists.ironpython.com
[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of
Sent: Wednesday, September 15, 2004 12:28 AM
To: users-ironpython.com at lists.ironpython.com
Subject: [IronPython] How to get the list of objects created

Is there any way to get the list of objects created?
for example : if create some objects like

              X = 4
		  Y = 6
              obj = StringBuilder

Now, i want to get the count of objects created and also the objects list.
Is there any command or group of commands to execute it.

Thanks in advance
Senthil Kumar
users-ironpython.com mailing list
users-ironpython.com at lists.ironpython.com

More information about the Ironpython-users mailing list