simple? embedding question

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Oct 30 22:39:39 EDT 2007


En Tue, 30 Oct 2007 16:38:12 -0300, <kyosohma at gmail.com> escribió:

> On Oct 30, 1:31 pm, snd... at gmail.com wrote:
>> suppose i have imported two modules foo and bar with
>> foo=PyImport_ImportModule("foo") and bar=PyImport_ImportModule("bar")
>> respectively.
>
> I'm confused. What is the benefit of importing this way in the first
> place? Everything I've read has always been either of the following
> (or a variant thereof):
>
> import foo
>
> or
>
> from foo import bar

They're different things. The PyImport_XXX stuff are C functions used in C  
code - usually inside an application *embedding* Python. The latter is  
plain old Python code.

-- 
Gabriel Genellina




More information about the Python-list mailing list