Re: caught in the import web again

2014-11-18 Thread Charles T. Smith
On Tue, 18 Nov 2014 00:00:42 -0700, Michael Torrie wrote: On 11/17/2014 03:45 PM, Steven D'Aprano wrote: Circular dependencies are not just a problem in Python, they are a problem throughout most of software design. Personally I find that duck typing eliminates a lot of the circular

Re: caught in the import web again

2014-11-18 Thread Ian Kelly
On Mon, Nov 17, 2014 at 6:20 PM, Dave Angel da...@davea.name wrote: Ian Kelly ian.g.ke...@gmail.com Wrote in message: On Mon, Nov 17, 2014 at 3:17 PM, Dave Angel da...@davea.name wrote: In a module that might get tangled in a cycle, avoid global code that depends on other modules. Instead

Re: caught in the import web again

2014-11-18 Thread Dave Angel
Ian Kelly ian.g.ke...@gmail.com Wrote in message: On Mon, Nov 17, 2014 at 6:20 PM, Dave Angel da...@davea.name wrote: Ian Kelly ian.g.ke...@gmail.com Wrote in message: On Mon, Nov 17, 2014 at 3:17 PM, Dave Angel da...@davea.name wrote: In a module that might get tangled in a cycle, avoid

Re: caught in the import web again

2014-11-18 Thread Chris Angelico
On Wed, Nov 19, 2014 at 6:09 AM, Dave Angel da...@davea.name wrote: I once worked on (and then fixed) a build system that could not complete a build from clean. It needed some pieces from a previous build in order to get to the point where it was ready to build those pieces. Recursive

Re: caught in the import web again

2014-11-18 Thread Dave Angel
Chris Angelico ros...@gmail.com Wrote in message: On Wed, Nov 19, 2014 at 6:09 AM, Dave Angel da...@davea.name wrote: I once worked on (and then fixed) a build system that could not complete a build from clean. It needed some pieces from a previous build in order to get to the point where

Re: caught in the import web again

2014-11-17 Thread Charles T. Smith
On Mon, 17 Nov 2014 08:08:40 +0100, dieter wrote: Charles T. Smith cts.private.ya...@gmail.com writes: ... Are others equally frustrated by this or is there a trick or principle that I'm missing. At this point, I guess the way I'll have to proceed is to put every class in its own file, no

Re: caught in the import web again

2014-11-17 Thread Dave Angel
Charles T. Smith cts.private.ya...@gmail.com Wrote in message: Well, I guess that's the definitive answer... the tips for delaying import are good, I'll try to leverage them. I was hoping there would be a way to have python postpone evaluation similar to C's forward references. In a

Re: caught in the import web again

2014-11-17 Thread Steven D'Aprano
Charles T. Smith wrote: Yes, we're talking about recursive imports here. It's a complex, object- oriented system with big classes and little classes that are strongly interrelated. Well, there's your problem right there. You're working with a complex, highly coupled code-base. Alarms bells

Re: caught in the import web again

2014-11-17 Thread Ian Kelly
On Mon, Nov 17, 2014 at 3:17 PM, Dave Angel da...@davea.name wrote: Charles T. Smith cts.private.ya...@gmail.com Wrote in message: Well, I guess that's the definitive answer... the tips for delaying import are good, I'll try to leverage them. I was hoping there would be a way to have python

Re: caught in the import web again

2014-11-17 Thread Dave Angel
Ian Kelly ian.g.ke...@gmail.com Wrote in message: On Mon, Nov 17, 2014 at 3:17 PM, Dave Angel da...@davea.name wrote: In a module that might get tangled in a cycle, avoid global code that depends on other modules. Instead of putting such initialization at top level, put inside a function

Re: caught in the import web again

2014-11-17 Thread Rick Johnson
On Monday, November 17, 2014 4:46:05 PM UTC-6, Steven D'Aprano wrote: [...] Python is not Java, nor Perl, and if you're putting every class into its own file, you are doing it wrong. Stop making these gross generalizations. Just because Java *REQUIRES* that you only have one class per file

Re: caught in the import web again

2014-11-17 Thread Chris Angelico
On Tue, Nov 18, 2014 at 1:17 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: BOY I LOVE TROGGING! For consistency, you should say GOVE there. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: caught in the import web again

2014-11-17 Thread Michael Torrie
On 11/17/2014 03:45 PM, Steven D'Aprano wrote: Circular dependencies are not just a problem in Python, they are a problem throughout most of software design. Personally I find that duck typing eliminates a lot of the circular dependency problems. Class A doesn't necessarily have to know about

Re: caught in the import web again

2014-11-17 Thread Steven D'Aprano
On Mon, 17 Nov 2014 18:17:13 -0800, Rick Johnson wrote: BOY I LOVE TROGGING! Yes, we've noticed. http://www.urbandictionary.com/define.php?term=trogging -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: caught in the import web again

2014-11-16 Thread Charles T. Smith
On Sun, 16 Nov 2014 08:14:05 +0100, dieter wrote: Charles T. Smith cts.private.ya...@gmail.com writes: Now, I'm getting these errors: ImportError: cannot import name ... and AttributeError: 'module' object has no attribute ... (what is 'module'?) Is there a way to resolve this

Re: caught in the import web again

2014-11-16 Thread Chris Angelico
On Sun, Nov 16, 2014 at 7:53 PM, Charles T. Smith cts.private.ya...@gmail.com wrote: Yes, we're talking about recursive imports here. It's a complex, object- oriented system with big classes and little classes that are strongly interrelated. I can get the imports configured properly so

Re: caught in the import web again

2014-11-16 Thread dieter
Charles T. Smith cts.private.ya...@gmail.com writes: ... Are others equally frustrated by this or is there a trick or principle that I'm missing. At this point, I guess the way I'll have to proceed is to put every class in its own file, no matter how small. Hopefully that takes care of

caught in the import web again

2014-11-15 Thread Charles T. Smith
Now, I'm getting these errors: ImportError: cannot import name ... and AttributeError: 'module' object has no attribute ... (what is 'module'?) Is there a way to resolve this without having to restructure my code every couple of days? I thought using imports of the form: from module

Re: caught in the import web again

2014-11-15 Thread Ben Finney
Charles T. Smith cts.private.ya...@gmail.com writes: Now, I'm getting these errors: Please reduce the problem to a minimal, complete example demonstrating the behaviour URL:http://sscce.org/ so that you can show us exactly what's happening. AttributeError: 'module' object has no attribute

Re: caught in the import web again

2014-11-15 Thread Denis McMahon
On Sat, 15 Nov 2014 22:52:33 +, Charles T. Smith wrote: Now, I'm getting these errors: ImportError: cannot import name ... and AttributeError: 'module' object has no attribute ... It would be useful to know what you're actually trying to import and what the complete error

Re: caught in the import web again

2014-11-15 Thread dieter
Charles T. Smith cts.private.ya...@gmail.com writes: Now, I'm getting these errors: ImportError: cannot import name ... and AttributeError: 'module' object has no attribute ... (what is 'module'?) Is there a way to resolve this without having to restructure my code every couple of