Re: import parent

2007-02-27 Thread Gary Herron
[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

Re: import parent

2007-02-27 Thread Larry Bates
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

Re: import parent

2007-02-27 Thread Ben Finney
[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,

Re: import parent

2007-02-27 Thread John Machin
On Feb 28, 8:01 am, 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? It shouldn't (in any language, not just Python). Callees should not in general need to inspect their caller's data structures, and shoul

Re: import parent

2007-02-27 Thread Bjoern Schliessmann
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. --