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


Groups > comp.lang.python > #47713

Re: Newbie: question regarding references and class relationships

Newsgroups comp.lang.python
Date 2013-06-11 17:02 -0700
References <kp4jf4$5fu$1@dont-email.me> <roy-FBA6CB.09354310062013@news.panix.com> <kp4lnn$hfi$1@dont-email.me> <mailman.2985.1370894224.3114.python-list@python.org>
Message-ID <cc0b10b6-1660-44a4-a9e4-05ab24b5eba1@googlegroups.com> (permalink)
Subject Re: Newbie: question regarding references and class relationships
From Rick Johnson <rantingrickjohnson@gmail.com>

Show all headers | View raw


On Monday, June 10, 2013 2:56:15 PM UTC-5, Ian wrote:
> [...]
> There are a couple of ways you might get this to work the way you
> want.  One is by adding as an extra layer a proxy object, which could
> be as simple as:
> class Proxy(object):
>     def __init__(self, ref):
>         self.ref = ref
> Instead of adding points to the model, add instances of Proxy that
> contain the points.  When adding points to the lines, add the same
> Proxy objects instead.  

Oh gawd just stop here! Are you joking? Are you playing coy? Are you attempting to confuse the lad? This type of complexity you suggest is what renders code bases unreadable and gives sloppy programmers "job security".

> Later, when you want to replace a point in the
> model, leave the Proxy in place but change the Point it contains by
> modifying the "ref" attribute.  Since the Line only directly
> references the Proxy, it must follow the same ref attribute to access
> the Point, and so in that way it will "see" the change.  The downsides
> to this approach are that you have to then use the Proxy objects all
> over the place and explicitly "dereference" them by using the ref
> attribute all over the place.

Teacher: "What is the worse thing since memory management?"
Jimmy Says: "ooh! ohh! i know!
Teacher: "Yes jimmy?"
Jimmy: "Superfluous memory management?"
Teacher: "Oh no, I'm sorry Jimmy, you're so close but i was looking for: `Superfluous memory management by proxy`!"

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 14:18 +0100
  Re: Newbie: question regarding references and class relationships Roy Smith <roy@panix.com> - 2013-06-10 09:35 -0400
    Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 14:57 +0100
      Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 15:00 +0100
      Re: Newbie: question regarding references and class relationships Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-10 13:56 -0600
        Re: Newbie: question regarding references and class relationships Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-11 17:02 -0700
  Re: Newbie: question regarding references and class relationships Peter Otten <__peter__@web.de> - 2013-06-10 15:49 +0200
    Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 14:59 +0100
      Re: Newbie: question regarding references and class relationships Peter Otten <__peter__@web.de> - 2013-06-10 16:28 +0200
        Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 15:38 +0100
          Re: Newbie: question regarding references and class relationships Peter Otten <__peter__@web.de> - 2013-06-10 17:05 +0200
            Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 16:20 +0100
              Re: Newbie: question regarding references and class relationships Peter Otten <__peter__@web.de> - 2013-06-10 17:55 +0200
                Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 17:09 +0100
                Re: Newbie: question regarding references and class relationships Peter Otten <__peter__@web.de> - 2013-06-10 19:07 +0200
                Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 18:42 +0100
                Re: Newbie: question regarding references and class relationships Dave Angel <davea@davea.name> - 2013-06-10 15:36 -0400
                Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 21:31 +0100
                Re: Newbie: question regarding references and class relationships Terry Jan Reedy <tjreedy@udel.edu> - 2013-06-10 15:51 -0400
                Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 21:13 +0100
                Re: Newbie: question regarding references and class relationships Terry Jan Reedy <tjreedy@udel.edu> - 2013-06-10 18:07 -0400
                Re: Newbie: question regarding references and class relationships Grant Edwards <invalid@invalid.invalid> - 2013-06-10 22:39 +0000
                Re: Newbie: question regarding references and class relationships Chris Angelico <rosuav@gmail.com> - 2013-06-11 08:54 +1000
                Re: Newbie: question regarding references and class relationships Tim Chase <python.list@tim.thechases.com> - 2013-06-10 18:24 -0500
                Re: Newbie: question regarding references and class relationships Dave Angel <davea@davea.name> - 2013-06-10 19:26 -0400
                Re: Newbie: question regarding references and class relationships Jason Swails <jason.swails@gmail.com> - 2013-06-10 23:49 -0400
  Re: Newbie: question regarding references and class relationships Terry Jan Reedy <tjreedy@udel.edu> - 2013-06-10 15:54 -0400
    Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-10 21:09 +0100
  Re: Newbie: question regarding references and class relationships Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-11 16:50 -0700
    Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-13 13:06 +0100
      Re: Newbie: question regarding references and class relationships Chris Angelico <rosuav@gmail.com> - 2013-06-14 00:07 +1000
        Re: Newbie: question regarding references and class relationships Rui Maciel <rui.maciel@gmail.com> - 2013-06-13 19:23 +0100

csiph-web