[Tutor] Trying to find a value in a function.

Magnus Lycka magnus@thinkware.se
Fri Mar 14 10:02:03 2003


At 10:15 2003-03-14 -0400, D2 wrote:
>Magnus Lycka a écrit:
>
>>Are you trying to make the program write itself? ;)
>That's true in some way.
>
>What i want to do is to create objects from text files

Do you mean to create instances of a predefined class from
data in a texts file (that's a fairly normal thing to do)
or do you mean that the text files should contain some
kind of descriptions that you use to create new classes
(which is more like black magic)?

I have a feeling that what you want to do is fairly simple
in python, but you haven't quite seen the (eventually)
simple and obvious way to do it, and we don't quite know
what you want... But maybe I'm wrong...

...
>Does that make sense ?

I'm not sure...

Could you please show us a simple example of such a text file,
and tell us what you want to happen with it. I think I need
something very concrete here...

If the text file contains python code, the obvious solution is
to *run* this code, not to try to analyze it.

Perhaps your "text files" should just contain class definitions
that inherit base classes that supply the bulk of the code?

If it's just data to be placed into instances of predefined
python classes, I don't see what's so complicated.

I also have a feeling that python dictionaries might be part
of the solution to your problems...

>Andre

-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se