News for hackers. Stuff that matters.
Re:Thoughts on Python 3 by the_mitsuhiko on Wednesday December 07, 2011 @05:22AM (#3323235)
> Sounds like the author of the article has no idea what a multimethod actually is then. :-)

The author (me) knows what multimethods are. I did however not find a better term to refer to the `iter(x)` -> `x.__iter__()` / `x.__getitem__()` concept.

Re:Thoughts on Python 3 by arethuza on Wednesday December 07, 2011 @05:36AM (#3323271)
I'm genuinely interested (not being snarky, honest) - could you explain why you think that expression has anything to do with multimethods? Like I said previously, I'm new to Python and I'm curious what that expression actually means.
Re:Thoughts on Python 3 by the_mitsuhiko on Wednesday December 07, 2011 @05:41AM (#3323283)
> could you explain why you think that expression has anything to do with multimethods?

You can override the behavior of a function based on the types involved. For instance ``coerce(a, b)`` calls ``a.__coerce__(b)``. By overriding ``__coerce__`` for one type you can customize this.

Re:Thoughts on Python 3 by arethuza on Wednesday December 07, 2011 @05:54AM (#3323301)
Do you then have to have conditional code in a.__coerce__(b) to check the type of b and do the appropriate thing?
Re:Thoughts on Python 3 by zephyrfalcon on Wednesday December 07, 2011 @05:57AM (#3323306)
Basically yes. Although there are ways around it: http://www.artima.com/weblogs/viewpost.jsp?thread=101605
Re:Thoughts on Python 3 by arethuza on Wednesday December 07, 2011 @06:27AM (#3323358)
Thanks - that looks quite neat.

It seems to me there is a big difference between having a language that is truly based on multimethods and one where it is possible to implement multimethods fairly easily - from what I can see Python looks more like the latter.

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.
Re:Thoughts on Python 3 by dschoon on Wednesday December 07, 2011 @05:23PM (#3326409)
I've always heard them referred to as "Generic Functions", though the Wikipedia article is annoying opaque.

The important quality (in my practical understanding) is that a generic function's specialization is decoupled from the object system -- delegating to `x.__iter__()` doesn't require `x` inheriting a method from a parent; the process `iter(x)` uses to delegate might not even require any type information about `x` at all.