[EMAIL PROTECTED] wrote:
> How does one get access to the class that imported a module. For example:
> foo imports bar -- how does bar access foo?
>
> Thanks.
>
>
If bar wants to access foo, it just imports it. If foo imports bar as
well, then you have circular imports, but Python can handle
Greg Hoover wrote:
> How does one get access to the class that imported a module. For example:
> foo imports bar -- how does bar access foo?
>
> Thanks.
>
I think we are having a problem understanding what you are asking.
If you mean an instance of class foo contains an instance of
class bar how
[EMAIL PROTECTED], [EMAIL PROTECTED] writes:
> How does one get access to the class that imported a module. For
> example: foo imports bar -- how does bar access foo?
If bar needs to know something specific from foo, then bar should
expose an interface that asks explicitly for that information,
, then you *may* pass oof as an arg to a
bar.some_function which may do things like
if oof_arg.zot > 42:
oof_arg.zot = 42
but this is not the preferred way.
Your subject "import parent" is "interesting". In what way is foo
considered to be the parent of bar?
f
Greg Hoover wrote:
> How does one get access to the class that imported a module. For
> example: foo imports bar -- how does bar access foo?
Directly? Not at all in sane programs, IMHO. That's the job of clear
interfaces.
Regards,
Björn
--
BOFH excuse #407:
Route flapping at the NAP.
--
How does one get access to the class that imported a module. For example:
foo imports bar -- how does bar access foo?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Is there a person on
> > this list who was against the "parent package" idea? He must know the
> > answer or a workaround :-)
>
> I just created a new module that can handle the 'from __.__.SomeModule
> import SomeClass' notation.
> Keywords: Python impo
now the
answer or a workaround :-)
I just created a new module that can handle the 'from __.__.SomeModule
import SomeClass' notation.
Keywords: Python import parent package
What is the right place to make it available for others?
Laci 2.0
--
___