Lisp mentality vs. Python mentality

Rhodri James rhodri at
Sun Apr 26 02:08:02 CEST 2009

On Sat, 25 Apr 2009 13:32:21 +0100, Ciprian Dorin, Craciun  
<ciprian.craciun at> wrote:

>>> Should I update the
>>> __eq__ method (for str class) and break almost everything? Can I write
>>> now a == b?

Should you instead, perhaps, write a case-insensitive string class, since
seems to be what your data is asking for?

>     I like object oriented programming, but most of the times we are
> just throwing together code and data even when the data has no
> behavior and the code is in fact just one possible processing
> algorithm. Like in the case you are mentioning, if I tie the
> comparison code to the actual data structure, then I'll never be able
> to reuse it... But if I leave the code as a standalone function, and
> just use the data (or any data that resembles the original structure)
> then maybe I'll be able to reuse it...

I'd say the reverse, personally.  A lot of what you've demonstrated is
varying algorithms, which are rarely going to reuse standalone code.
They still need to deal with case-insensitive strings, though.

Rhodri James *-* Wildebeeste Herder to the Masses

More information about the Python-list mailing list