News for hackers. Stuff that matters.
Re:Thoughts on Python 3 by aidenn0 on Wednesday December 07, 2011 @01:24PM (#3325059)
That's called "Operator overloading" In this case the operator happens to look like a function, but it's not really any different than a + b -> a.__add__(b)
Re:Thoughts on Python 3 by DasIch on Wednesday December 07, 2011 @02:53PM (#3325593)
That's not just simple operator overloading. What mitsuhiko refers to is that iter() can iterate over an object not just when you implement __iter__() but also when you implement __getitem__() and __len__(), bool() has similar semantics as do several other functions and operators.