import precedence

Mark McEahern mark at mceahern.com
Tue Jun 25 09:26:53 EDT 2002


Suppose I have a package like this:

  spam/
    __init__.py
    setup.py
    foo.py

For cygwin, setup.py creates:

  foo.dll

For linux2, setup.py creates:

  foo.so

But for win32, setup.py is basically a no-op because I can do what I need to
do in foo.py using pythoncom.

Here's the question:

Can I just assume that:

  from spam import foo

will only import the foo.py module if the foo.dll and foo.so are not
found--that is, if the import statement is executed on win32 (where those
extensions won't exist)?

I looked at the documentation for import and it's not clear to me that it
addresses this issue.  Perhaps because noone in their right mind would
consider this approach?  ;-)

Thanks,

// mark

-






More information about the Python-list mailing list