On Sun, Dec 27, 2009 at 11:46:51AM -0800, John H Palmieri wrote:
> > Does anyone know a trick to access the global variables for the "main"
> > scope?
>
> I hope other people have other suggestions, but a few weeks ago I
> found a code snippet on the web which allows you to access locals(),
> and maybe that will help in your situation: see
>
> <http://pythonic.pocoo.org/2009/5/30/finding-objects-names>

Thanks for the link! I was not aware of sys._getframe.

Building on it, I currently have a pure Python implementation that
seems to work fine (doctests+interpreter+notebook), though it uses a
not-so-nice heuristic.

See #7776 and #7777 ( cool number :-) ) for an application.

As the code says: better suggestions welcome!

Cheers,
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to