On Wed, 15 Oct 2008 14:34:14 +0200, Mr.SpOOn wrote:Well, yes... I actually changed my mind. I didn't have so much types
Something that is more pythonic is something that doesn't use
multimethods. It's just an elaborated way to do type checking. In python,
you usually avoid type checking and if-elif-block-with-isinstance in
favor of Duck Typing and EAFP (Easier to Ask Forgiveness than Permission,
i.e. try-block).
to working with, so the if-elif block is ok. But I was curious to know
if there was a "better" way.
*smells a bad class design* If that is the case, I'd recommend onMmm, yes, maybe it was a bad design. Not sure. Anyway I changed it :D
splitting that behavior into two or more functions/operators (or possibly
splitting the class). It's hard to reason the behavior of a class if the
class is that complex (Simple is better than complex; Complex is better
than complicated. The Zen of Python this:2-3).