The reason is that TextWithDash has a Text object
> attribute and delegates most of its methods to that object
> via __getattr__ and __setattr__. Can anyone tell me why
> this approach was favored over deriving TextWithDash from
> Text?
I think __getattr__ and __setattr__ are mostly evil since they lead to
hard to debug code and break things like tab completion in ipython and
object inspection. I'm +1 for refactoring TextWiithDashes to use
inheritance or otherwise expose the attributes directly.
JDH
OK, I refactored TextWithDash, and my changes passed backend_driver.py.
setp(axes().get_yticklabels()) gives a comprehensive list as of svn 2206. The
old TextWithDash is still there, but masked, just in case.
Darren
···
On Tuesday 21 March 2006 18:53, John Hunter wrote:
> The reason is that TextWithDash has a Text object
> attribute and delegates most of its methods to that object
> via __getattr__ and __setattr__. Can anyone tell me why
> this approach was favored over deriving TextWithDash from
> Text?
I think __getattr__ and __setattr__ are mostly evil since they lead to
hard to debug code and break things like tab completion in ipython and
object inspection. I'm +1 for refactoring TextWiithDashes to use
inheritance or otherwise expose the attributes directly.
Strike that, John found a bug that was exposed by dashtick. I reverted back to
the old behavior.
···
On Wednesday 22 March 2006 09:49, Darren Dale wrote:
On Tuesday 21 March 2006 18:53, John Hunter wrote:
>
> > The reason is that TextWithDash has a Text object
> > attribute and delegates most of its methods to that object
> > via __getattr__ and __setattr__. Can anyone tell me why
> > this approach was favored over deriving TextWithDash from
> > Text?
>
> I think __getattr__ and __setattr__ are mostly evil since they lead to
> hard to debug code and break things like tab completion in ipython and
> object inspection. I'm +1 for refactoring TextWiithDashes to use
> inheritance or otherwise expose the attributes directly.
OK, I refactored TextWithDash, and my changes passed backend_driver.py.
setp(axes().get_yticklabels()) gives a comprehensive list as of svn 2206.
The old TextWithDash is still there, but masked, just in case.
I fixed the bug John pointed out, and unmasked the refactored version of
TextWithDash in svn 2226.
Darren
···
On Wednesday 22 March 2006 14:24, Darren Dale wrote:
On Wednesday 22 March 2006 09:49, Darren Dale wrote:
> On Tuesday 21 March 2006 18:53, John Hunter wrote:
> >
> > > The reason is that TextWithDash has a Text object
> > > attribute and delegates most of its methods to that object
> > > via __getattr__ and __setattr__. Can anyone tell me why
> > > this approach was favored over deriving TextWithDash from
> > > Text?
> >
> > I think __getattr__ and __setattr__ are mostly evil since they lead to
> > hard to debug code and break things like tab completion in ipython and
> > object inspection. I'm +1 for refactoring TextWiithDashes to use
> > inheritance or otherwise expose the attributes directly.
>
> OK, I refactored TextWithDash, and my changes passed backend_driver.py.
> setp(axes().get_yticklabels()) gives a comprehensive list as of svn 2206.
> The old TextWithDash is still there, but masked, just in case.
Strike that, John found a bug that was exposed by dashtick. I reverted back
to the old behavior.