12 comments

[ 4.1 ms ] story [ 38.5 ms ] thread
There's a few missing:

@ For matrix multiplication, equivalent to __matmul__

@= <<= >>= ^= |= Assignment operators

Thanks for the mentions. I am sure it is helpful to anyone reading the threads.
Simple and clear. Even if I don't do Python I learned some good ideas (like the // floor operator).
I am glad it was helpful.
After you're mastered all the available operators the real fun begins when you start writing your own operator methods on classes http://thepythonguru.com/python-operator-overloading/

The ability to override operators is one of the things I miss most from Python when I'm forced to write javascript.

The section on assignment operators is incorrect. x += y modifies the object x, whereas x = x + y doesn't. For example,

  >> a = [1, 2, 3]
  >> b = a
  >> a += [4]
  >> a
  [1, 2, 3, 4]
  >> b
  [1, 2, 3, 4]
By comparison,

  >> a = [1, 2, 3]
  >> b = a
  >> a = a + [4]
  >> a
  [1, 2, 3, 4]
  >> b
  [1, 2, 3]
This is especially true for the case of mutables. I agree it should've been mentioned on the blog. Do you mind if I add this thread to the comments section of the blog.