From: Mario Camou on 15 Nov 2009 20:16
Have a look at Forwardable
On Monday, November 16, 2009, Seebs <usenet-nospam(a)seebs.net> wrote:
> I have a type which has a bit of internal magic, but fundamentally, I want
> it to behave for most purposes like the value it yields from to_i/to_int.
> Basically, is there a way to avoid having to write +, -, etcetera, when
> in each case it'd be:
> def <op>(other)
> self.to_i <op> other
> I think I'm thinking something like the Comparable mixin; sort of a
> "I have a to_i, make me a number" module.
> Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
> http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
> http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I want to change the world but they won't give me the source code.