On Thu, Apr 10, 2008 at 7:43 AM, Ludwig Schwardt <[EMAIL PROTECTED]>
wrote:

When I tried to go deeper, I found it really hard to decide which
> files I needed where in the Leo hierarchy. And what if the code in one
> node needed code in another node? Do I clone it into the required
> node, or do I import it via Python? With "standard" IDEs, the file
> hierarchy is very clear, while with Leo the Leo hierarchy is very
> clear and the file hierarchy obscure.


Several comments:

Leo can't really help you choose how to break a (python) project into
files.  That's part of the skill of writing python programs.  My general
rule of thumb is: put only related items in a single .py file.  Leo's .py
files provide many examples.

For programming projects, I organize my master .leo file in two ways: by
topic (Notes, Projects, To Do) and by file.  I use @thin files like
leoNotes.txt, leoProjects.txt, leoToDo.txt and leoToDoLater.txt to keep the
actual .leo file small: all the data are in thin .txt or thin .py files, so
leoPy.leo remains very small.

I use @all in the .txt files so that I can clone nodes from the .py files
and put the clone in the .txt file.  However, I *strongly* recommend that
you do not use clones in .py files to duplicate code. Imo, this is extremely
bad style, at least for Python.  For languages such as html, that do not
have functions, using clones to duplicate code is less bad style :-)

As usual, the best way to learn something is to try various ways and see
what works.

I actually wished I could do
> away with files and simply run things from the Leo hierarchy!


This is possible with Leo, in some cases: put your code in @button nodes, or
just run scripts in the body pane with the execute-script command.
scripts.leo has dozens of examples of this.

I then ditched Leo, and started with a single Python file, which
> allowed me to start testing right away, without the big top-down
> design approach I took with Leo. As the file grows, the idea is to
> refactor into modules / classes / functions, as needed.


This will work.  It's not the way I would do it, but so what?  If it works
for you it is a great approach.

I do remember when I started using Python, my first questions involved the
basic work flow:  how do I go beyond typing 2+2 and getting 4 in the Python
interpreter.  With Leo, you have two main choices:

1. Write scripts in the body pane, and use execute-script (or use a script
button).

2. Create .py files on the file system (with @thin) and then leave Leo and
execute those files.  On xp, I use .bat files to make this simple.
Similarly, on Linux I use executable batch files.

Edward

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to