It seems like this acts as a sort of interactive interpreter plus the introspection. I guess it could be used to bypass what I often use IPython for, which is introspection.
On Monday, November 16, 2015 at 10:23:28 AM UTC-5, Terry Brown wrote: > > On Mon, 16 Nov 2015 04:46:28 -0800 (PST) > john lunzer <[email protected] <javascript:>> wrote: > > > I think one way to make Leo more powerful and easier to learn is to > > further expose Leo to itself. > > > > I recently was messing around with Terry's introspection script which > > lays outs the guts of an opject in a tree format. I did an > > introspection on g. Think of it as a dir(g) on steroids. What if the > > g subtree was alive? What if a Leo tree could represent live python > > object in a running python program, in this case specifically g in > > Leo itself. You could fully interact and modify these live subtrees. > > Sort of related, I use vs-eval / vs-last / vs-last-pretty from the > valuespace plugin, described below. > > These three commands are things I added to the valuespace plugin in what > I think was a misguided attempt to avoid creating yet another plugin, > thye're really unrelated to valuespace, except that they execute in the > namespace created by the valuespace plugin, c.vs. Misguided, because I > think they're very useful and more generally understandable than the > rest of the valuespace plugin, which is clever, but complicated. > > Having executed some code with vs-eval, I've used the introspection > script to introspect the results by answering "c.vs" to it's > "Introspect what" question. > > From the docs: > > vs-eval > > Execute the selected text, if any. Select next line of text. > Tries hard to capture the result of from the last expression in the > selected text: > > import datetime > today = datetime.date.today() > > will capture the value of today even though the last line is a > statement, not an expression. Stores results in c.vs['_last'] for > insertion into body by vs-last or vs-last-pretty. Removes common > indentation (textwrap.dedent()) before executing, allowing execution of > indented code. g, c, and p are available to executing code, assignments > are made in the c.vs namespace and persist for the life of c. > > vs-last > > Insert the last result from vs-eval. Inserted as a string, so > "1\n2\n3\n4" will cover four lines and insert no quotes, for repr() > style insertion use vs-last-pretty. > > vs-last-pretty > > Insert the last result from vs-eval. Formatted by pprint.pformat(), so > "1\n2\n3\n4" will appear as '"1\n2\n3\n4"', see all vs-last. > > Evaluating expressions > > All expression are evaluated in a context that predefines > Leo's c, g and p vars. > > > > Cheers -Terry > > > I do this manually through the IPython plugin (ILeo). It is a little > > painful because executing scripts has known issues with output and > > pdb doesn't work right when Leo is in ILeo mode. > > > > If this concept could be extended to creating a live tree for any > > running python program it could turn Leo into one of the most > > powerful debugging tools available. > > > > I give Smalltalk (Pharo) some credit. The entire environement is > > alive and you can mess with any running object you want assuming you > > know what you're looking for. > > > > Anyway, just a thought. Maybe it can lead to some exciting ideas for > > Edward. Gotta get this guy Leo motivated again ;) > > > > > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
