search speed

rdmurray at rdmurray at
Sat Jan 31 05:37:50 CET 2009

Quoth Tim Chase <tim at>:
> PS:  as an aside, how do I import just the fnmatch function?  I 
> tried both of the following and neither worked:
>    from glob.fnmatch import fnmatch
>    from glob import fnmatch.fnmatch
> I finally resorted to the contortion coded below in favor of
>    import glob
>    fnmatch = glob.fnmatch.fnmatch

What you want is:

    from fnmatch import fnmatch

fnmatch is its own module, it just happens to be in the (non __all__)
namespace of the glob module because glob uses it.


More information about the Python-list mailing list