One of the recurring difficulties with multimethods is the concept of method resolution order. If you have multiple methods with the same name but different parameter types in scope, and you call the method with types such that more than one method which can accept them, how do you decide which one to dispatch to? … More Yet Another Python Multimethod Decorator, Part 7: What You’re Trying To Do Is Wrong
OK, so our multimethod decorator is progressing nicely. It’s robust and versatile in ways it wasn’t before, handling a whole bunch of common situations sensibly in a way our starting point didn’t. Let’s do something with it that might actually seem reasonable to want to do. flatten is a simple function which takes a list, … More Yet Another Python Multimethod Decorator, Part 5: Duckfaces
So, now our multimethod decorator produces things which actually behave like a function – it follows sensible scoping rules, and binds properly so it can be used as a method. That shouldn’t be a high bar, but there you go. Now let’s look at how we might use it. I’m clearly writing this the wrong … More Yet Another Python Multimethod Decorator, Part 4: What about subclasses?
So, to recap briefly, we’ve taken Guido’s five minute multimethods and made them respect scope. We’re happily creating a bunch of different implementations of foo in different contexts, some of which are multimethods and some of which are plain functions. It’s all going swimmingly. Then we try to do something like the following: class Foo: … More Yet Another Python Multimethod Decorator, Part 3: Multimethod Methods
Last time, I was complaining how Guido’s five-minute multimethod implementation isn’t production-ready (without explaining why not). A bit churlish, you may say – it clearly wasn’t intended to be that. It’s just a starting-point showing off some fancy syntactic sugar. Fair point. So, what’s wrong with it, and how can we fix it? The first … More Yet Another Python Multimethod Decorator, Part 2: Respecting Scope
“I used to believe that multimethods were so advanced I would never need them. Well, maybe I still believe that, but here’s a quick and dirty implementation of multimethods so you can see for yourself. Some assembly required; advanced functionality left as an exercise for the reader.” – Guido Van Rossum Why might you need … More Yet Another Python Multimethod Decorator, Part 1: Why?
this is the fifth part of an ongoing series of posts discussing my implementation of units of measure in scala and the various thoughts about programming language design it prompted this particular post follows on from the fourth post on syntax which in turn really requires the first post to make sense at the end … More Ruminations on a system of units in measure in Scala, part 5: Infix and suffix notation vs punctuation.