Re: Coping with cyclic imports

2013-07-05 Thread Cameron Simpson
On 05Jul2013 10:36, Oscar Benjamin wrote: | On 5 July 2013 02:24, Cameron Simpson wrote: | > On 04Jul2013 16:03, Oscar Benjamin wrote: | > | Is there some reason you're responding to a post from 5 years ago? | > | > Is there some reason not to, if no newer solutions are available? | | No, I was

Re: Coping with cyclic imports

2013-07-05 Thread Oscar Benjamin
On 5 July 2013 02:24, Cameron Simpson wrote: > On 04Jul2013 16:03, Oscar Benjamin wrote: > | > | Is there some reason you're responding to a post from 5 years ago? > > Is there some reason not to, if no newer solutions are available? No, I was genuinely curious. My way of accessing this forum/ne

Re: Coping with cyclic imports

2013-07-04 Thread Cameron Simpson
On 04Jul2013 16:03, Oscar Benjamin wrote: | On 4 July 2013 13:48, wrote: | > On Tuesday, April 8, 2008 10:06:46 PM UTC+2, Torsten Bronger wrote: | > http://stackoverflow.com/questions/744373/circular-or-cyclic-imports-in-python | | Is there some reason you're responding to a post from 5 years

Re: Coping with cyclic imports

2013-07-04 Thread Dave Angel
On 07/04/2013 11:11 AM, kanchan.n.maha...@gmail.com wrote: On Thursday, July 4, 2013 5:03:20 PM UTC+2, Oscar Benjamin wrote: On 4 July 2013 13:48, wrote: On Tuesday, April 8, 2008 10:06:46 PM UTC+2, Torsten Bronger wrote: [snip] If you do "import foo" inside bar and "import bar" insi

Re: Coping with cyclic imports

2013-07-04 Thread kanchan . n . mahajan
On Thursday, July 4, 2013 5:03:20 PM UTC+2, Oscar Benjamin wrote: > On 4 July 2013 13:48, wrote: > > > On Tuesday, April 8, 2008 10:06:46 PM UTC+2, Torsten Bronger wrote: > > [snip] > > > > > > If you do "import foo" inside bar and "import bar" inside foo, it will work > > fine. By the time

Re: Coping with cyclic imports

2013-07-04 Thread Oscar Benjamin
On 4 July 2013 13:48, wrote: > On Tuesday, April 8, 2008 10:06:46 PM UTC+2, Torsten Bronger wrote: [snip] > > If you do "import foo" inside bar and "import bar" inside foo, it will work > fine. By the time anything actually runs, both modules will be fully loaded > and will have references to e

Re: Coping with cyclic imports

2013-07-04 Thread Dave Angel
On 07/04/2013 08:48 AM, kanchan.n.maha...@gmail.com wrote: On Tuesday, April 8, 2008 10:06:46 PM UTC+2, Torsten Bronger wrote: Hallöchen! I have a rather fat module that represents a document parser -- inline elements, block elements, and the like. Now I want to split it into many modules to m

Re: Coping with cyclic imports

2013-07-04 Thread kanchan . n . mahajan
On Tuesday, April 8, 2008 10:06:46 PM UTC+2, Torsten Bronger wrote: > Hallöchen! > > I have a rather fat module that represents a document parser -- > inline elements, block elements, and the like. Now I want to split > it into many modules to make everything more manageable. > > But at the mome

Re: Coping with cyclic imports

2008-04-09 Thread Duncan Booth
Torsten Bronger <[EMAIL PROTECTED]> wrote: > So, the last question is: Under which circumstances does this > happen? It happens when you import a module which imports (directly > or indictly) the current module and which comes before the current > module in the import order while the program runs

Re: Coping with cyclic imports

2008-04-09 Thread Torsten Bronger
Hallöchen! Jeffrey Froman writes: > [...] > > Cyclic imports are not a problem by themselves, but cyclic > definitions are. Thus: > > # a.py > import b > x = 1 > > # b.py > import a > x = 2 > > works fine, but: > > # a.py > import b

Re: Coping with cyclic imports

2008-04-08 Thread Jeffrey Froman
Torsten Bronger wrote: > I know that cyclic imports work in Python under certain > circumstances.  Can anyone refer me to a page which explains when > this works? I don't know of a specific URL offhand. Cyclic imports are not a problem by themselves, but cyclic definitions are. Thus: #

Coping with cyclic imports

2008-04-08 Thread Torsten Bronger
Hallöchen! I have a rather fat module that represents a document parser -- inline elements, block elements, and the like. Now I want to split it into many modules to make everything more manageable. But at the moment I don't see how to avoid cyclic imports: A document element A, which is repres