Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#739 Import of modules with common prefix marked as a problem

closed-works-for-me
Editor (491)
5
2008-06-29
2008-06-27
pm13
No

If two modules with common prefix are imported, they are marked as double import.

This code works:

import xml.dom # marked - "Unused import: xml"
import xml.sax # marked - "Import redifinition: xml"

print xml.dom.Node
print xml.sax.ContentHandler

Discussion

  • Fabio Zadrozny
    Fabio Zadrozny
    2008-06-29

    Logged In: YES
    user_id=617340
    Originator: NO

    Hi,

    Actually, that's correctly marked considering how python works: when you do: import xml.dom, you'll have both: 'xml' and 'xml.dom' in your namespace. In that case that appears strange, but if you did:

    from my_project import xml
    import xml.dom

    It would be more clear that there could be something wrong (because the 'xml' token available would be the one from 'import xml.dom' and not the one obtained in 'from my_project import xml')

    Cheers,

    Fabio

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2008-06-29

    • status: open --> closed-works-for-me