On Sunday, February 5, 2017 at 9:50:54 PM UTC-6, Sr U wrote: > > https://www.programiz.com/python-programming/examples/calculator > > I suspect Leo is not catching on because of marketing errors. > Specifically, you haven't recognized and properly met the needs of Leo's > NATURAL /obvious target market: BEGINNING PYTHON PROGRAMMERS WHO ARE > OVERWHELMED WITH COMPLEXITY. >
I think your remarks are perfectly aligned with my present plans, which involve simplifying the tutorials and creating easy-to-see demos. The next release isn't going out the door until your concerns are addressed. Besides the Learn about Leo in two hours <http://leoeditor.com/tutorial.html> link on Leo's home page, there should be a "Learn about Leo in 20 minutes" link :-) > [maybe] you haven't understood your customer's real pain; their real > needs. Your customers need simplicity and they need step by step. When > coming to Leo they want to get the experience of writing a simple -- but > real and extensible -- program in a few minutes. > An excellent goal. > At the risk of assuming too much, I believe *I* am a pretty good example > of your ideal customer: (1) I haven't already settled on another > editor/IDE. (2) I have a problem with dealing with the complexity that > larger programs demonstrate in all the other editors I've looked at. (3) > I want my programs to be factored into an easily traversible outline > format. (4) I am a beginner at python -- although I am smart enough and > motivated to learn. > Yes, you *are *somebody in Leo's target audience. Bringing you up to speed so that others will benefit from your experience is a worthy goal. And perfectly timed. I came here several months ago and asked for a simple tutorial. I'm back > here and it still doesn't exist. Maybe you can take 10 minutes and create > something to help me and probably many others? > I'm happy to take as long as it takes. There is no more important part of Leo's development. This is a simple python program with 4 functions and just enough simplicity > to be understandable and relevant to any beginner python programmer and > just enough complexity to demonstrate the advantage of Leo's hierarchical > view: > > https://www.programiz.com/python-programming/examples/calculator > Yes. A reasonable example. You probably already know that Leo's principles apply to scripts and programs of any size. Would you please help me (I really need some help to get started) by > factoring this in Leo, running it, and posting a link to the factored code > so I can load it and look at it for myself? > I well remember my first questions about Python. I attended the Python conference in Washington DC (in February, 2011, iirc), *just to ask such questions*. I knew that Python was cool, but I didn't see how to use it outside the Python interpreter. The answer to my questions was simple: you create a script in some editor, and then you tell the Python interpreter to run it. The best way to do this is via script/batch files, so you can just do this in a programming console: >python myprogram.py I got it to work in my terminal window but it is throwing an error I don't > understand in Leo (maybe because I haven't inserted any of your sentinals?). > Hah. This is a problem that I have never considered before. Newbies (in any field) have an extremely low threshold of debilitating confusion. Any particular thing can be confusing. Put two confusing things together and you get paralysis. In this case, you are confused by the error message *and* the question of whether sentinels complicate matters. And if you think debugging will be harder in Leo, you are likely to give up immediately. There are two ways to deal with error messages. Both are useful in some situations. 1. Use Alt-G line number to select the line *near* the true cause of the problem. This is almost always what I do. Experienced python programs have a whole mental catalog of typical errors and their typical causes. Newbies just have to dig in and discover why Python is complaining. If you are looking at a traceback, the real cause of the problem is almost always at the last line. Don't be freaked out by the length of long tracebacks. Just look at the last line. Everything else is context which usually can be ignored. 2. In rare cases, I'll open an external file in another editor. I use scite <http://www.scintilla.org/SciTE.html>on both Windows and Linux. Ctrl-G in scite will take you to the offending line. Please notice the irony of what is going on. You are beginning *not* to be a newbie. You will probably remember your initial confusions for a long long time. But you will never be quite as confused as you once were, and you will no longer need the same kind of help you once did. And notice how many words I have just used explaining something basic. Not exactly "the less said the better" > I think the main body should be in one node with global variables in > another and each function in a separate node -- but I don't know how to do > that. > It's easy to show in Leo, and a future demo should definitely do this. Let me talk you through it. I'm going to do the same thing as I write this. 0. Make sure you are running Leo from a console window <http://leoeditor.com/running.html#running-leo-from-a-console-window>. Print statements send their output to the console. 1. Create a node whose headline is "test". 2. Paste the entire text of the example into the body text. 3. *Save the outline*. The next step is going to crash Leo! 4. Type Ctrl-B. Hah. The "input" statements causes Leo to loop. Wouldn't you know, a beginners demo crashes Leo! All is not lost. Repeat steps 0-2. Comment out the three input statements, *save Leo again*, and hit Ctrl-B again. You will see: Select operation. 1.Add 2.Subtract 3.Multiply 4.Divide Now *here's the cool thing*. Once this works, do the following: 1. Select the "test" node, the node containing your script. 2. Type <Alt-x>parse-body<Return> This executes Leo's parse-body command. Leo has automatically converted your single node into a tree of nodes. Notice that the last node contains all the statements following the last function, the divide function. parse-body is undoable. Ctrl-Z restores your test node to what it was before. Try it! Shift-Ctrl-Z redoes the parse-body command. *Extremely important*: you can *still* run your program from Leo even after you have split it into nodes: 1. Select the top-level node. It should contain only @others. 2. Do Ctrl-B as before. You should get the *same* output. *Running this program outside Leo* Somewhat humorously, you picked a "simple" program that crashed Leo. Many scripts can indeed be run from Leo without creating external files. But let's see how to run the program you want. Do this: 1. Change the headline from "test" to @file test.py. This will create test.py in the directory containing your .leo file. If you don't want that directory, change the headline to: @file <path> test.py 2. Restore the input statements that crashed Leo. 3. Save the Leo outline (Ctrl-S). Leo will create the external file. 4. Switch out of Leo and do this in a console: cd <path> python test.py This should execute the original program. Further steps would be to guide the new Leo user, in a series of maybe 3-10 > lessons, to develop the calculator code base in Leo -- ideally to > eventually make a GUI calculator with additional functions (demonstrating > how Leo can work with outside libraries and classes perhaps). > That would be a good tutorial for Python, but what we have just done is what you need to use Leo effectively. But this FIRST step is the most critical: to show a beginning programmer > that Leo is FRIENDLY and easy to use for THEM. > Well, I hope I have just done so. > What you are currently saying in your documentation (after digging through > multiple sections which are basically a lot of words which don't mean much) > is *"This chapter is intended for those fairly comfortable with Python > scripting. If you are not, please study the excellent Python Tutorial > <http://docs.python.org/2/tutorial/>."* Big mistake. > I think we'll have to disagree about this. Consider what we have just accomplished. You should now be able to run *any* Python program from Leo. But Leo can't teach you Python. Only you can do that. Further, even advanced python programming experience doesn't really > translate to any solid advantage in grasping Leo. > That's true enough. That is the focus of Leo's present tutorials. I hope to improve them using the "less said the better" principle. I'm not currently much of a programmer but I used to code quite a bit and I > hold multiple technical degrees. The current Leo documentation is an > extensive thicket > Part of this thicket can be pruned away. You are quite right in stressing that tutorials must be a simple as possible. But Leo is a power tool. It's developed over decades. It's used by some of the world's most experienced developers. There is a lot of material that can't be pruned away. Happily, Leo outlines make the thicket manageable. > I suggest you take 95% of existing documentation and HIDE IT AWAY under > "Advanced uses". > I think your real complaint is that the so-called tutorials are too difficult. I agree completely. > Ed: Hopefully I haven't irritated you by trying to give constructive > criticism. > No worries about that. Your concerns are perfectly reasonable. I expect to spend a week or so improving the documentation. I am also excited about the new demo plugin. It may be possible to have Leo's help command contains a few demos. I believe you have a much needed, brilliant creation in Leo. But few can > unwrap the package in order to try it out. > My intention is to make this wrapping significantly easier before the next release goes out the door. > I'm suggesting you put your many other improvements on hold until you > can get folks such as myself operational creating a real program, properly > factored in Leo, in a few minutes. > Again, that's my intention. As a practical matter, I have to deal with significant bugs as they arise. I am just about to turn to the documentation. Thanks for making this gift available to us! > You're welcome. You've given me new incentive to improve Leo's docs. Edward -- 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 https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
