Discussion: new operators for numerical computation

Bjorn Pettersen bjorn at roguewave.com
Thu Jul 20 12:39:04 EDT 2000


John Lull wrote:
> 
> (posted & mailed)
> 
> Huaiyu Zhu <huaiyu_zhu at yahoo.com> wrote:
> 

[snip]

> >    - Do we want a copy operator := which is different from =?  It allows
> >      efficient code.  The following code does not change A
> >          B := A
> >          B += C
> >      This definitely will be usable for other classes. Call it __copy__?
> 
> I'm not convinced this is terribly useful.  We can already write B =
> A.copy(), and I don't see how the function notation is any substantial
> disadvantage here.  I could be persuaded otherwise.

Note also that := has repeatedly been suggested as the assignment
expression, so you can e.g. do:

  while line := f.readline():
    foo(line)

(vs. the current kludgy pydiom...) it's also been repeatedly denied, but
I'd still rather see assignment expressions added than assignment
operators.

-b




More information about the Python-list mailing list