[Python-ideas] Extend unicodedata with a name search

Andrew Barnert abarnert at yahoo.com
Sat Oct 4 11:28:52 CEST 2014


On Oct 4, 2014, at 8:21, Steven D'Aprano <steve at pearwood.info> wrote:

> 1) fuzzy_lookup(glob):
>    Return iterator which yields (ordinal, name) for
>    each unicode code point which matches the glob.
> 
>    Names beginning with a substring:
>        fuzzy_lookup("SPAM*")
> 
>    Names ending with a substring:
>        fuzzy_lookup("*SPAM")
> 
>    Names containing a substring:
>        fuzzy_lookup("SPAM")

Surely that last one is "*SPAM*", right? Otherwise this is a weird sort of glob where * doesn't match anything on this end, it instead constrains the opposite end or something. 

At any rate, why would you expect glob here? There's really nothing else in Python that uses glob patterns except for glob/fnmatch, which are explicitly matching equivalent OS services. It doesn't seem any more natural to think of the database as a directory of files than as a file of text or a database of key values, so why not a regex, or a SQL like pattern, or something else?


More information about the Python-ideas mailing list