[Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.9,1.10
Fredrik Lundh
fredrik@effbot.org
Fri, 2 Mar 2001 09:46:15 +0100
> On Thu, Mar 01, 2001 at 11:31:27AM -0800, Ka-Ping Yee wrote:
>
> > --- 128,135 ----
> > """Return the Python module name for a given path, or None."""
> > filename = os.path.basename(path)
> > ! for ending in ['.py', '.pyc', '.pyd', '.pyo',
> > ! 'module.so', 'module.so.1', '.so']:
> > ! if len(filename) > len(ending) and filename[-len(ending):] == ending:
> > ! return filename[:-len(ending)]
>
> 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()]" ?
Cheers /F