On Tue, May 05, 2009 at 06:41:41AM -0500, Kent Tenney wrote: > On Mon, May 4, 2009 at 5:40 PM, Stephan Richter > <srich...@cosmos.phy.tufts.edu> wrote: > > On Monday 04 May 2009, Kent Tenney wrote: > >> So the magic in *.txt is ad-hoc for each package? > > > > It is not magic. > > I've considered the '>>>' prompt an interpreter prompt, so > >>> write('file', """content""") > always looked a bit magical to me.
Since it's not a Python builtin, and it wasn't explicitly imported in the doctest, it does look a bit like magic. Quack, quack. > > But yes, each doctest file > > can have a different set of global variables. > > Ah. > The ones available for, say, buildout, look so useful, I > thought they might be a convention, and packaged. I'd say it's too early. Not every package needs to deal with real files and directories. In fact, I'd say most of the packages don't. > In trying to understand code I like to tweak the doctest and > see what happens. I'll look into the feasibility of adding a > line to the top of buildout/README.txt like > >>> import dtglobals > > where dtglobals would expose all the good > !magic, without requiring the test scaffolding. Make that 'from myglobals import *' and you've got it. (A suggestion like this would not be complete without a warning: people dislike 'import *' and have good reasons for that dislike. Use it sparingly.) Marius Gedminas -- Give a man a computer program and you give him a headache, but teach him to program computers and you give him the power to create headaches for others for the rest of his life... -- R. B. Forest
Description: Digital signature
_______________________________________________ Zope3-users mailing list Zope3email@example.com http://mail.zope.org/mailman/listinfo/zope3-users