31.08.17 15:49, Steve D'Aprano пише:
On Thu, 31 Aug 2017 05:51 pm, Serhiy Storchaka wrote:
31.08.17 10:10, Steven D'Aprano пише:
(iii) Not every two line function needs to be in the standard library.
Just add this to the top of every module:

def equal(s, t):
      return s.casefold() == t.casefold()

This is my answer.

Unsolved problems:

This proposal doesn't help with sets and dicts, list.index and the `in`
operator either.

This is the end of the discussion.

Your answer of an equal() function doesn't help with sets and dicts either.

See rejected issue18986 [1], PEP 455 [2] and corresponding mailing lists discussions. The conclusion was that the need of such collections is low and the problems that they are purposed to solve can be solved with normal dict (as they are solved now).

So I guess we're stuck with no good standard answer:

- the easy two-line function doesn't even come close to solving the problem
   of case-insensitive string operations;

It is not clear what is your problem exactly. The easy one-line function solves the problem of testing case-insensitive string equality. Regular expressions solve the problem of case-insensitive searching a position of a substring. If you asked a solution that magically prevent people from making simple programming mistakes, there is no such solution.

[1] https://bugs.python.org/issue18986
[2] https://www.python.org/dev/peps/pep-0455/

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to