Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80840 > unrolled thread

caught in the import web again

Started by"Charles T. Smith" <cts.private.yahoo@gmail.com>
First post2014-11-15 22:52 +0000
Last post2014-11-18 09:13 +0000
Articles 1 on this page of 21 — 11 participants

Back to article view | Back to comp.lang.python


Contents

  caught in the import web again "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2014-11-15 22:52 +0000
    Re: caught in the import web again Ben Finney <ben+python@benfinney.id.au> - 2014-11-16 10:43 +1100
    Re: caught in the import web again Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-16 01:11 +0000
    Re: caught in the import web again dieter <dieter@handshake.de> - 2014-11-16 08:14 +0100
      Re: caught in the import web again "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2014-11-16 08:53 +0000
        Re: caught in the import web again Chris Angelico <rosuav@gmail.com> - 2014-11-16 20:20 +1100
        Re: caught in the import web again dieter <dieter@handshake.de> - 2014-11-17 08:08 +0100
          Re: caught in the import web again "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2014-11-17 20:07 +0000
            Re: caught in the import web again Dave Angel <davea@davea.name> - 2014-11-17 17:17 -0500
            Re: caught in the import web again Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-17 15:52 -0700
            Re: caught in the import web again Dave Angel <davea@davea.name> - 2014-11-17 20:20 -0500
            Re: caught in the import web again Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-18 08:28 -0700
            Re: caught in the import web again Dave Angel <davea@davea.name> - 2014-11-18 14:09 -0500
            Re: caught in the import web again Chris Angelico <rosuav@gmail.com> - 2014-11-19 07:18 +1100
            Re: caught in the import web again Dave Angel <davea@davea.name> - 2014-11-18 17:58 -0500
        Re: caught in the import web again Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-18 09:45 +1100
          Re: caught in the import web again Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-17 18:17 -0800
            Re: caught in the import web again Chris Angelico <rosuav@gmail.com> - 2014-11-18 13:25 +1100
            Re: caught in the import web again Steven D'Aprano <steve@pearwood.info> - 2014-11-18 07:13 +0000
          Re: caught in the import web again Michael Torrie <torriem@gmail.com> - 2014-11-18 00:00 -0700
            Re: caught in the import web again "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2014-11-18 09:13 +0000

Page 2 of 2 — ← Prev page 1 [2]


#81000

From"Charles T. Smith" <cts.private.yahoo@gmail.com>
Date2014-11-18 09:13 +0000
Message-ID<m4f2jg$jh5$1@dont-email.me>
In reply to#80995
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
> dependency problems.  Class A doesn't necessarily have to know about
> Class B to work with instances of Class B.  All that has to be known is
> what methods are going to be available on those instances.  The
> interface pattern can help here if you wanted a bit more safety (like
> what Zope provides).  Either way it breaks up the dependency cycle
> nicely.
> 
> If Class A needs to instantiate instances of Class B (which depends on
> Class A), then it could call a factory method to do so, perhaps set up
> by a third party after both modules have been imported.
> 
> There are lots of methods of avoiding the issue entirely.
> 
> In the C or C++ world, I find that signalling frameworks can also be
> used to break a dependency cycle.  For example, if Class A needs to call
> a method on an instance of Class B (which in turn depends on Class A),
> that could be done instead as a signal, which is later connected to
> Class B's method after everything is successfully instantiated.  Also
> makes testing a bit easier, because you can simply hook up the signals
> to a test harness.



A bunch of useful thoughts.  Thanks, folks!

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.python


csiph-web