Den 8. des. 2006 kl. 15.43 skrev Kent Johnson:
> Arild B. Næss wrote:
>> Den 8. des. 2006 kl. 14.05 skrev Kent Johnson:
>>> Why do you need to pickle the function? Is it created
>>> dynamically? Can you just pickle the data?
>>>
>>> Kent
>>>
>> Thanks.
>> I guess it's not absolutely necessary to pickle the function. I
>> tried to do this because I wanted to use the function in the
>> interpreter without having to write it in there line by line.
>> I'm used to working in R and Matlab, where you often run scripts
>> from the active interpreter. In that way you can actually
>> examine the data a script generates, instead of having the script
>> print it to screen or file.
>> I'm having trouble getting used to python like this because I get
>> trouble trying to paste in several lines at once from emacs, and
>> I haven't found a way to run scripts in the interpreter.
>
> Two suggestions:
> - Use an editor / IDE that allows you to run Python scripts. IDLE
> will do this. I think emacs has good support for Python too but
> someone who uses emacs will have to help you with that one.
>
> - Save your function in a module and import the module from the
> interpreter. Then you can run the function in the interpreter.
>
> For example if you have funcs.py in the working directory and it
> contains a function
> def doItAll():
> pass
>
> then in the interpreter you can type
> >>> import funcs
> >>> funcs.doItAll()
>
> to run the function.
>
> If you change the function in an external editor you have to reload
> it in the interpreter to get the revised version:
> >>> reload(funcs)
Thanks. That worked.
I haven't found out how to change the working directory in IDLE,
though – and for some reason it seems to be a different one this
session from the last one. Does anyone know?
(I use a mac by the way.)
>
> PS Please reply to the list, not to me directly.
Sorry about that. I didn't realize my client picked your adress and
not the list's when I clicked reply. My mistake.
regards,
Arild Næss
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor