[Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.9,1.10

Ka-Ping Yee ping@lfw.org
Fri, 2 Mar 2001 03:00:30 -0800 (PST)


On Fri, 2 Mar 2001, Fredrik Lundh wrote:
> > 
> > Out of curiosity, why are you specialcasing 'module.so.1' ? Shouldn't that
> > be r'module\.so\.\d+' ? Or even better, r'module\.so(\.\d+)*' ?
> 
> or "for ending in [x[0] in imp.get_suffixes()]" ?

Yup, i did that a few hours ago.  Check out the current version in CVS...


    suffixes = map(lambda (suffix, mode, kind): (len(suffix), suffix),
                   imp.get_suffixes())
    suffixes.sort()
    suffixes.reverse() # try longest suffixes first, in case they overlap
    for length, suffix in suffixes:
        if len(filename) > length and filename[-length:] == suffix:
            return filename[:-length]


-- ?!ng

"I've been listening to my gut since i was 14, and frankly speaking,
i've come to the conclusion that my guts have shit for brains."
    -- Rob, High Fidelity