[Python-Dev] Update PEP 292

Raymond Hettinger python at rcn.com
Fri Aug 20 19:04:46 CEST 2004


> > However, the reason I didn't speak up earlier was because I thought
> > Raymond had a good technical point about his failure in getting your
> > package to work, and I can't in good conscience support the package
> > until that's resolved.
> 
> Did you try it?  I'm really interested in getting additional feedback,
> because AFAIK only Raymond and I have.  It works for me, but doesn't
for
> him.
> 
> But if the package problem turns out to be real, we shouldn't support
> it, or expend too much effort fixing it.

That part is not a package problem.  The circular import issue occurs
whether you put Template in string.py or in a string package.  Try a
quick experiment to confirm on your machine:

  Take your existing string.py, add a couple of lines:

       import re
       pattern = re.compile('bingo')

  Now, clear out your pyc files, start python and import re.

  Here's what I get:

C:\py24\Lib>python
Python 2.4a2 (#46, Aug 19 2004, 18:01:28) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\PY24\lib\re.py", line 5, in ?
    from sre import *
  File "C:\PY24\lib\sre.py", line 98, in ?
    import sre_parse
  File "C:\PY24\lib\sre_parse.py", line 16, in ?
    import string, sys
  File "string.py", line 43, in ?
    pattern = re.compile("bingo")
AttributeError: 'module' object has no attribute 'compile'



Raymond



More information about the Python-Dev mailing list