News for hackers. Stuff that matters.
Re:Python 3.4.0 released by babarock on Monday March 17, 2014 @06:50AM (#7414255)
Here's a good explanation of this technique: http://julien.danjou.info/blog/2013/python-3.4-single-dispat...
Re:Python 3.4.0 released by bcoates on Monday March 17, 2014 @12:49PM (#7416216)
If I understand the PEP right, this explanation is missing the part where it's only useful to extend abstract classes; python classes are open so you can just add a method to a concrete class to get single-dispatch if that's all you need. I don't think the example given needs generics at all.
Re:Python 3.4.0 released by eurleif on Monday March 17, 2014 @02:56PM (#7417226)
>python classes are open so you can just add a method to a concrete class to get single-dispatch if that's all you need.

Except then your method shares a namespace with all the other methods defined on the class, which is ugly, and can cause clashes.

Re:Python 3.4.0 released by hyperpape on Monday March 17, 2014 @02:37PM (#7417078)
I had a hard time understanding the value of the idea from this as well. The link I gave made it a bit clearer to me.
Re:Python 3.4.0 released by ubertaco on Monday March 17, 2014 @09:22AM (#7414841)
Nice! That's something I like about Haskell and Elixir: the ability to define behavior for a given case. Though it looks like that's constrained to type-based dispatch (a la Java method overloading). Is there any way to define for specific values?
Re:Python 3.4.0 released by hyperpape on Monday March 17, 2014 @10:09AM (#7415048)
If I read this article properly, there's nothing yet standardized, but there's a possibility of future development: http://lukasz.langa.pl/8/single-dispatch-generic-functions/.