sequence multiplied by -1

Ethan Furman ethan at stoneleaf.us
Mon Oct 4 12:14:05 EDT 2010


Antoon Pardon wrote:
> Suppose you write your class so that '+' will provide addition and
> you provide a method concat to concatenate. Now no matter how usefull
> the sequence library would be for you, you can't use it. You will
> have to rewrite those function you need, in terms of a concat method
> instead of '+'.
> 
> That also means that whatever sequence like functions you write
> for this class, you can't use those functions for sequences in
> general because in general, sequence don't have a concat method.


Do you have an example of where this would be useful?

Thanks.

~Ethan~



More information about the Python-list mailing list