PyDev of the Week: Edward Ream

This week we welcome Edward Ream as our PyDev of the Week! Edward is the creator of the Leo (Leonine Editor with Outlines) text editor / outliner. He has been using Python since 2001. You can see what Edward has been working on over on Github. Let’s spend some time getting to know him better!

Driscoll: Can you tell us a little about yourself (hobbies, education, etc):

Ream: ​Piano, walking, science, literature, history. I read Science and Nature every week. I encourage your readers to do the same. Start with reading the summary articles and the abstract for each article. They are written for non-specialists. All scientists are lay people outside their immediate area!

I have taken piano and theory lessons for many years from Michael Butkus-Bormier. He knows approximately everything about music. He’s a great jazz and classical performer. And a close friend.

I regularly do laughter yoga. It’s easily the most transformative thing I have done, including the Hoffman Process and the Landmark Education Forum. I find that laughter helps me to connect with people and eases anxiety in social situations.

Laughter is a huge help to creativity.  I vividly remember a video of “Ham & Clyde” laughing while discussing their work with J. Craig Venter.  Alas, I can’t find the link. Oh btw, Ham is a Nobelist.

I walk regularly to solve problems.  The trick is to daydream. When any relevant thought appears I write it down in a 89 cent notebook. The idea is to forget what I have just written down so new thoughts appear. Trying to remember things kills further daydreaming.

Rebecca is my muse.  She’s a gardener and weaver, but she asks great questions when I talk to her about Leo, even especially technical questions. Think about how great that is!

The idea that I could use the MORE outliner as a prototype for (what became) Leo arose in conversation with her.  Very likely none of this would have happened without her.

Driscoll: Why did you start using Python?

Ream: Because Apple broke its promise about porting YellowBox to Windows. So objective-c was out of the question.

I started learning Python in early 2001.  I went to the Pycon that year outside DC and got snowed on. It’s a strange feeling walking near the Capital and seeing no traffic.

Driscoll: What other programming languages do you know and which is your favorite?

Ream: Python is my favorite by far. It’s maddening that the web could have been based on Python.

Just this year I realized that it’s not about the javascript language. It’s about the tools.  So I’m learning about the node.js and vue.js world, driven by Leo’s devs.

Driscoll: What projects are you working on now?

Ream:  Leo is my life.This page contains summary items for my plans.​At this moment Chris George and I are working on Leo’s theme machinery. The longer term plans:

2. Integrating Joe Orr’s great vue.js stuff.
Be sure to scroll to the bottom of the page.
3. Keeping up with vscode, atom, etc. 😉

Driscoll: Which Python libraries are your favorite (core or 3rd party)?

Ream: pyflakes, by far.  Python devs are wasting their time if they don’t use it.  I’ve studied every line of its code. It’s a work of genius.

pyflakes catches essentially all of my initial blunders. It’s so fast that I can configure Leo to run pyflakes whenever I save a .py file.  I configure Leo to raise a dialog when pyflakes detects an error 😉

Driscoll: How did you get into the Leo project?

Ream: Leo grew out of my efforts to understand Donald Knuth’s CWEB system. This was supposed to be a big advance in understand programs, but I couldn’t make sense of it! The first big Aha was: “webs are outlines in disguise”.

I invented the precursor to Leo in 1995 and have been working on it ever since. The History of Leo page contains the details. Later, web collaboration rescued me from lack of ideas and energy. Now, we are all overwhelmed by ideas for improving Leo.

Driscoll: Can you give us an overview of what Leo is?

Ream: I have struggled with this question from the beginning. Leo’s wikipedia page is a dry summary. Leo’s preface is another. But these might not help you or your readers much.

I could answer “sideways” by listing the great programmers who have contributed to Leo: Terry Brown, Brian Harry, Bernhard Mulder, Vitalije Milosevitch, Ville M. Vainio, etc. When I have doubts about Leo I remember them 🙂

You must use Leo to really understand it. We Leonistas talk about the Leonine World. Many people do get it:

“When first I opened Leo, it was out of curiosity. But having used it, I’ll never go back. They’ll have to pry Leo out of my cold, dead fingers!” Travers A. Hough

You will find similar sentiments throughout the What People are Saying about Leo page.

But still.  All this is indirect. As Vitalije pointed out recently, the real Aha is that Leo thoroughly connects outline structure with the code itself.

With Leo, code isn’t just text.  It lives in a “super duper outline”, namely a directed acyclic graph.  Such a data structure, and no other, allows simple definitions of clones.

Clones free outlines from static organization. Data, including parts of programs, can reside in arbitrarily many places in the same outline.  I use this all the time. I gather clones of the methods I am working so that I can see them clearly.  This eliminates a lot of searching. Leo’s clone-find commands leverage clones in a spectacular way, but I don’t want to overwhelm your readers 😉

All code/scripts have easy access to the outline in which they are embedded. Leo’s execute-script command defines three constants: c, g and p.  c is the gateway to all of Leo’s live code g is a python module containing lots of useful utils. Most importantly, p is the presently selected node in the outline. p.h is its headline. p.b is its body text. p.u is an arbitrarily extensible set of u’s (user-defined attributes).

Leonine scripts are scripts with automatic access to c, g and p.  To give you just a glimpse of the power of such scripts, here is the second “hello world” example. Put this in any Leo node and do Ctrl-B (execute-script):

for p in c.all_positions():
    print(p.level()*' ' + p.h)

It prints all the headlines in the outline, properly indented.

That’s the entire script. Notice the dogs that aren’t barking!

But this is just the beginning. The c constant, via easy to use methods on c, allows scripts to modify the outline in which they reside.  Some users, including my brother, use this to turn Leo into a database.

I’m going on and on, so I’ll leave it to interested readers to learn about @button nodes, @test nodes, and all the rest.
Neither atom nor vscode are likely to have these features.  Emacs org mode comes closest, but in org mode everything is still plain text.

Driscoll: What are some lessons you have learned working in Open Source?

Ream: My most important goal is to bring out the best in others. Very rarely I’ve had to deal with people with mistaken views  I always correct those mistakes with the idea that that person may come up with great ideas later.

I train people not to be too respectful of my ideas by occasionally changing my mind 😉 I want people, even newbies, to push back against my opinions. Now, just about everything new happens as the result of urgent user requests 😉

I am not the greatest programmer.  However, I am a good project manager.  I can say this because Leo’s devs have created things that I never dreamed of:

  • @clean and the Mulder/Ream update algorithm would never have happened without Bernhard Mulder.
  • @button would not have happened without ‘e’.
  • Leo’s minibuffer grew out of Brian Harry’s prototype.
  • Leo’s IPython bridge would not have happened without Ville Vainio.

The project comes first. We never disparage people, though we may debate technical issues in depth. Sheesh, you would think this is just common sense, but apparently not.

We have a rule that we never debate preferences. We create a Leo setting if there are two legitimate, important, incompatible, ways of having Leo work. This eliminates useless arguments.

We have never had problems with trolls is leo-editor, perhaps because all access to it is moderated. I’m an evidence based guy, with no time for anything or anyone else.

One last thing. Last year I realized that Leo is my entire professional life. Progress has increased significantly since I went “all in”.

Driscoll: Is there anything else you’d like to say?

Ream: Work flow is paramount. I immediately create github issues for everything. The goal is not to have to remember anything. I continue to find ways that Leo can speed my work flow.

If your readers have not already done so, I highly recommend that they read Getting Things Done. Read the entire book, not some summary. Much of what I am about to say stems from this book.
Recently I have relearned the fundamental lesson that procrastination saps energy.  I am intensely focused on doing one thing at a time.  This means, for example, that even the smallest mental nits must be cleared.  Some can be filed in my Leo outlines. Others are better put in new github issues.
I’ve been programming for 40+ years. It’s important to respect my natural body rhythms. I take regular breaks in the afternoon, after making sure that I am not trying to remember anything. This is the only way to survive long term.
Driscoll: Thanks for doing the interview!