[SciPy-dev] New Operators in Python
dmitrey
openopt at ukr.net
Sat Mar 24 05:05:52 EDT 2007
But are you able to redefine the '\' operator? Afaik it's implemented in
Python core as new line continuing.
As me I would make available '.x' operators as first step. Then,
probably, I would implement xx operators for matrices, like **, ^^, //,
etc. + Probably I would raise a warning or error of "old-style cast"
current operators. And some years later I would made them as errors.
WBR, D.
Joachim Dahl wrote:
> That's a great idea! Having equivalents to Matlab's A\b and A.*B
> would make numerical codes
> simpler, and even though it may not sound terribly important to
> Python purists, it would
> help to make Python a more intuitive alternative to Matlab also.
>
> Asking the Python developers how they feel about user-defined dyadic
> operators can't hurt, and
> it doesn't sound like a large change that developers will object.
>
>
> On 3/24/07, *Travis Oliphant* <oliphant at ee.byu.edu
> <mailto:oliphant at ee.byu.edu>> wrote:
>
>
> Every so often the idea of new operators comes up because of the
> need to
> do both "matrix-multiplication" and element-by-element multiplication.
>
> I think this is one area where the current Python approach is not as
> nice because we have a limited set of operators to work with.
>
> One thing I wonder is if we are being vocal enough with the Python
> 3000
> crowd to try and get additional operators into the language itself.
>
> What if we could get a few new operators into the language to help us.
> If we don't ask for it, it certainly won't happen.
>
> My experience is that the difficulty of using the '*' operator for
> both
> matrix multiplication and element-by-element multiplication
> depending on
> the class of the object is not especially robust. It makes it
> harder to
> write generic code, and we still haven't gotten everything completely
> right.
>
> It is somewhat workable as it stands, but I think it would be nicer if
> we could have some "meta" operator that allowed an alternative
> definition of major operators. Something like @* for example (just
> picking a character that is already used for decorators).
>
> I wonder if we should propose such a thing for Python 3000.
>
> -Travis
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.org <mailto:Scipy-dev at scipy.org>
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
More information about the SciPy-Dev
mailing list