[Tutor] object design question

Alan Gauld alan.gauld at btinternet.com
Wed May 16 22:57:13 CEST 2007

"Kent Tenney" <ktenney at gmail.com> wrote

> The class I'm working on does conversion between ReStructuredText
> and the Leo (http://leo.sf.net)file format. It also
> wraps rst->html rst->xml etc.

OK, I still don;t knoew exactly what it is. But I'll take a guess
from what you say that that you have an Rst text stored in one
file and want to convert it to Leo text, maybe in another file.

The way I'd do that is create an RSTFile class that is initialised
with a file name and Rst version(defaulted appropriately)

I'd probably provide a method called generateLeo(LeoVersion)

So it looks like:

rst = RstFile('rstfilename.rst')

You could of course create a LeoFile class too, in which case the 
second line might be:


Where the initialiser is a Leo text - you could have the option
of using a leofile to initialise and making both file classes
more like a traditional python file...

There are, as you observed, no *right* answers when defining
classes/objects it depends on how you intend to use them.

The above may be missing the point entirely, in which case
just ignore me! :-)

Alan G. 

More information about the Tutor mailing list