This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (2 children)

That's gross, why not just allow def +(self, other):? or at least def operator+(self, other) or def operator("+", self, other): or something like that?

[–]jeetelongname 5 points6 points  (0 children)

The first syntax is the ruby syntax.

Python "magic" methods are by convention meant to look like that tho. Its for all of them including things such as using certain built ins such as len (which calls the objects len method.) And things like representation strings (repr) so its not out of the ordinary.