Octave as a module for Python

David Grundberg c04dgg at cs.umu.se
Wed May 6 07:34:51 CDT 2009


Jaroslav Hajek skrev:
> On Tue, May 5, 2009 at 9:32 PM, David Grundberg <c04dgg at cs.umu.se> wrote:
>   
>> Announcing Pytave
>
> Hi David,
>
> I have wrapped also the "eval" function into pytave - see the attached
> patch (created using bzr diff). How should I go about it? Should
> contributions be reported as bugs using the launchpad tracker? Sorry I
> have no experience with neither bazaar nor launchpad.
>
> summary:
> "eval" is provided as a wrapper to eval_string (parse.h). In
> principle, this could be achieved more simply using feval("eval", but
> the advantages are:
> 1. faster (avoids double call and double conversion of code string)
> 2. explicit control of printing rather than implicitly with nargout (as in eval)
> 3. a separate exception class for parse error
>
> regards
>
>   
Hi Jaroslav,

Glad to see you improving my software! As your patch is of a manageable 
size, you might as well open a bug report and attach your patch.

I have some comments

1. As the code stands, it is not possible to catch pytave.ParseError. 
([module pytave has] "no attribute 'ParseError'") In order to be 
correctly declared, the octave_parse_exception will have to be returned 
by the _pytave::get_exceptions function and correctly assigned to a 
symbol named ParseError in pytave.py.
2. It's unnecessary to duplicate the value conversion documentation, I 
think it'll be easier to maintain if it just referred to feval.

I'm attaching a modified patch as a suggestion. I modified the semantics 
of the nargout parameter since 0 is valid input.

Furthermore, I see that the builtin eval function accepts a second code 
string, CATCH. What are the purpose of this argument, and why did you 
not include it?

sincerely,
David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pytave_eval_suggest.patch
Type: text/x-patch
Size: 11314 bytes
Desc: not available
Url : https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20090506/9bbe3bbe/attachment.bin 


More information about the Help-octave mailing list