"Ciprian Dorin, Craciun" <ciprian.crac...@gmail.com> writes: > A practical example: I have lists that contain strings, but I want > to compare them in an case-insensitive way... Should I update the > __eq__ method (for str class) and break almost everything? Can I write > now a == b? Nop... I need the loop you've just mentioned in all the > places where the comparison changes just in the operator, not in the > algorithm... (I would say this is bad coding practice...)
In Lisp I think you'd use (equal (mapcar upcase a) (mapcar upcase b)) or something like that. In Python, a.upper() == b.upper(). Really, Python uses its object system more heavily than old-school Lisp did, but in other regards (despite the howls of partisans on both sides) they are really not that different from each other. -- http://mail.python.org/mailman/listinfo/python-list