Extensions on Linux: import without underscore?

Terry Hancock hancock at anansispaceworks.com
Sun Jun 19 23:02:04 EDT 2005


On Saturday 18 June 2005 10:35 pm, James Carroll wrote:
> Hi, I'm creating an extension called _bright.so on linux.  I can
> import it with import _bright, but how can I import bright and get the
> package?
> 
> On windows, I've been able to import bright instead of import _bright,
> but on Linux it seems to need the underscore.  I'm tempted to create a
> bright.py with from _bright import *, but I'm wondering if there's a
> more direct way.

Okay, you may want a more elegant way to do this and other people
have already responded to that point, but you do at least know you
can just give it a new name:

import _bright
bright = _bright

right?

You can attach a new name to any Python object trivially (this is
akin to a pointer assignment in C, it does not copy any significant
amount of data).

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list