Quote:
Originally Posted by capink
I think this would be more clear if illustrated with pseudo code.
Also, feedback from others would help crystallize this whole thing even more.
|
I agree. As for
pydef it's clear, it's a locally defined function as it already exists in python.
But for the class... I have a hard time seeing how we go from that:
Code:
class x(object):
def do_it(mi, locals_dict, a, b, ...)
python code goes here
the code must return a string or None
to this:
Code:
python_functions['x'].do_it(mi, locals, a, b, c)
—
Quote:
Originally Posted by capink
I was thinking about a completely seprate mode that would start with a keyword like python: as opposed to program:. But your idea has its merits because it allows mixing both modes.
|
Wow, that could be very powerful indeed. But it would be necessary to define its "main function" as well as its arguments, a bit like it is the case for template functions. This would allow to create "template function for single use".
Code:
python:
def main(mi):
...
your python code
...
Note that since python accepts local definitions, we can all write in main()
...
Thinking about it, I'm not sure that
python: is really useful if you add the
pydef.
We just have to define:
Code:
program:
pydef __main__(mi) # start your python code
...
your python code
...
fedyp # end your python code
main() # run your python code
And now we have our complete python implementation. We just have to define/documente that the function
__main__(*args) <> main() are special functions where
main() without arguments calls
__main__(*args) with the arguments related to the book.