[Python-ideas] Detecting circular imports ?

Michael Foord fuzzyman at voidspace.org.uk
Fri Nov 19 00:21:08 CET 2010


On 18 November 2010 23:14, M.-A. Lemburg <mal at egenix.com> wrote:

> Greg Ewing wrote:
> > Georg Brandl wrote:
> >> But to think of
> >> that, you already need to suspect circular imports, and then it's easy
> >> to see it from the traceback anyway.
> >
> > Right. Whenever I've had a problem with circular imports, it
> > was usually fairly obvious what the cause was.
>
> Same here and most cases I've had in the past actually presented
> themselves as... ImportErrors :-)
>


If you use the "from module import something" form it will be an
ImportError. If you do "import module" and then "module.something" you will
see an AttributeError. These are the ones that can be confusing.

Michael



>
> --
> Marc-Andre Lemburg
> eGenix.com
>
> Professional Python Services directly from the Source  (#1, Nov 19 2010)
> >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
> >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
> >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
> ________________________________________________________________________
>
> ::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
>
>
>   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>           Registered at Amtsgericht Duesseldorf: HRB 46611
>               http://www.egenix.com/company/contact/
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



-- 
http://www.voidspace.org.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20101118/467e3941/attachment.html>


More information about the Python-ideas mailing list