[PEP draft 2] Adding new math operators

Gregory Lielens gregory.lielens at fft.be
Wed Aug 9 12:38:55 EDT 2000


Konrad Hinsen wrote:
> 
> Robin Becker <robin at jessikat.fsnet.co.uk> writes:
> 
> > I thought that's what you must be implying. The implementation part is
> > the problem ie can you 'fake' the conversions without too much work.
> 
> Yes. This is much simpler to implement than any other proposal in this
> thread.
> 
> > Can't numpy already present the same data in strange ways ie isn't the
> > header data separate from the real data so that I can set B=A[1,:]
> > without creating a new copy of the first row (ie B is a slice).
> 
> Exactly. One would simply generate a second header referring to the
> same data and with a different type information.

Don't you fear the "backtracking" aspect, i.e. to have to track back the
code to check the types of A and B, before knowing the operation which
is perfromed by A 'op' B? 
I know this is already the case now, for example if A and B are strings,
A+B is a concatenation instead of an addition...Fair for me in this case
because I consider string and int to be quite different beasts (sorry
all perl-lovers :-)), and expect to be able to differentiate them by
context quite easily...
However, when making the 'op' behavior differ for two very close classes
(as array and matrix would obviously be), I think it could be a lot more
error-prone...Similar (worst?) to the classical "1/2 == 0 (oops - why
not 0.5?)" which pop up sometimes in this newsgroup...

Greg.



More information about the Python-list mailing list