[Tutor] Operator Overloading Importance

Remco Gerlich scarblac@pino.selwerd.nl
Wed, 27 Feb 2002 09:55:05 +0100

On  0, Dan Shafer <pydan@danshafer.com> wrote:
> How important is it to understand how to do operator overloading in 
> your early Python experience? I've written code -- though not 
> horribly complex stuff for the most part -- in a number of languages 
> which allowed operator overloading and never used it.

I don't think it's very important. I've never used it yet.

> Yet "Learning Python" makes a pretty big issue out of it in the 
> chapter on objects, making it seem even more important than a good 
> understanding of how objects are created and managed (which makes me 
> suspicious to begin with).
> So should I take the time to learn this now or can it wait? Or is it 
> ever really useful?

If you have objects on which these operations are natural, data that you
will want to add routinely, etc, then I guess it's useful. It's useful to
know that it is possible.

But if you don't think you'll need it, you can skip it without trouble.

Also, some other special methods like __str__() are often useful.

Remco Gerlich