[Numpy-discussion] Casting Bug or a "Feature"?

Matthieu Brucher matthieu.brucher@gmail....
Thu Jan 17 01:34:27 CST 2013


Hi,

Actually, this behavior is already present in other languages, so I'm -1 on
additional verbosity.
Of course a += b is not the same as a = a + b. The first one modifies the
object a, the second one creates a new object and puts it inside a. The
behavior IS consistent.

Cheers,

Matthieu


2013/1/17 Paul Anton Letnes <paul.anton.letnes@gmail.com>

> On 17.01.2013 04:43, Patrick Marsh wrote:
> > Thanks, everyone for chiming in.  Now that I know this behavior
> > exists, I can explicitly prevent it in my code. However, it would be
> > nice if a warning or something was generated to alert users about the
> > inconsistency between var += ... and var = var + ...
> >
> >
> > Patrick
> >
>
> I agree wholeheartedly. I actually, for a long time, used to believe
> that python would translate
> a += b
> to
> a = a + b
> and was bitten several times by this bug. A warning (which can be
> silenced if you desperately want to) would be really nice, imho.
>
> Keep up the good work,
> Paul
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
Information System Engineer, Ph.D.
Blog: http://matt.eifelle.com
LinkedIn: http://www.linkedin.com/in/matthieubrucher
Music band: http://liliejay.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130117/2caef57b/attachment-0001.html 


More information about the NumPy-Discussion mailing list