Matlab vs Python (was RE: Discussion: Introducing new operators for matrix computation)
Huaiyu Zhu
hzhu at localhost.localdomain
Tue Jul 18 16:00:32 EDT 2000
On 18 Jul 2000 11:56:53 GMT, Kevin Jacobs <jacobs at darwin.epbi.cwru.edu> wrote:
>Not really. From what I've seen, the Python expression syntax is
>significantly simpler than the full grammar. At least, its much simpler to
>parse.
So it has to be restricted to expressions.
>> One of my biggest gripe about matlab is it forces me to treat strings as
>> part of matrix. Now you are asking me to treat matrix as part of string.
>> :-)
>
>Not matrices, just matrix expressions. Maybe this isn't such a big deal
>for me since I grew up with LISP and Scheme.
Would you allow literal matrix initialization like Matrix([[1,2],[3,4]])
inside the quote?
>I have no problem with adding syntax for defining new operators. In fact, I
>think that Standard ML allows just that. I know I've seen a proposal
>something like this posted already, but lets consider a builtin like:
>
>add_infix_operator('.*', default_binary_element_multiply_evaluator,
> '__relement_multiply__', # Right associative class member
> '__lelement_multiply__') # Left associative class member
>
>where the default evaluator is called if the right or left associative
>member evaluators are not specified on the operand classes. Such a scheme
>would be sufficient if all the proposed linear-algebra syntax used valid
>operators. It should be possible to augment the Python grammar to support
>this, though its certainly not trivial.
I think this is the best way, but don't know if anybody is able to do it.
Huaiyu
More information about the Python-list
mailing list