On 1/24/07, Jim Jewett <[EMAIL PROTECTED]> wrote: > (on python-dev) Kristján V. Jónsson wrote: > > > We have been using gc.get_objects() but it has several problems: > > 1) ... results in a list so long that it often kills the system. > > In Py3K, should this also return an iterator, rather than a list? > > In other words, is the dict.items change something specific to dicts, > or something that could happen with any large sequence?
It should be considered on a case-by-case basis, depending on how the result is most commonly used, or perhaps what's the most useful result. I don't know if it makes sense given the GC implementation to do it in this case. (For example, I looked briefly into making os.listdir() an iterator, but decided against it because you'd have a file descriptor open while iterating, and the list is never truly long.) > > 2) There is no way to frame certain operations and get just those > > objects that were created during their execution. ... storing the id()s of > > all objects > >... the ambiguity of id() in the face of objects being created and destroyed. > > Changing id() to be something other than the address probably isn't > practical, but with the elimination of old-style classes, everything > should inherit from object. Would it make sense to add optional > timestamping (or other alternative id-like attributes)? > > Right now, the best solution I see is to use a debug build and a C > debugger to inspect the serial number that _PyObject_DebugMalloc > sticks after its FORBIDDENBYTE barrier. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
