Modifying builtin type behaviour

Gerrit gerrit at nl.linux.org
Tue Feb 17 11:17:49 EST 2004


Jean-S?bastien Bolduc wrote:
> I'm afraid this is a silly question, to which I know the answer
> already. But let me ask anyway...
> 
> In Python, is there a way to modify a builtin type's methods? for
> instance, modifying int.__add__ to behave as multiplication, I would
> obtain 2+5 == 10. I emphasize that I don't want to modify the Python
> source, but change the types behaviour _from within Python_.

Why?

> Help would be appreciated!

I'm almost sure it isn't possible...

Gerrit.

-- 
Weather in Twenthe, Netherlands 17/02 15:25 UTC:
	5.0°C light drizzle mostly cloudy wind 2.7 m/s WNW (57 m above NAP)
-- 
Asperger's Syndrome - a personal approach:
	http://people.nl.linux.org/~gerrit/english/




More information about the Python-list mailing list