Re: [matplotlib-devel] units support in svn

2007-03-21 Thread Eric Firing
Fernando Perez wrote:
> On 3/21/07, Eric Firing <[EMAIL PROTECTED]> wrote:
> 
>> Properties would be OK for 2.3; I was thinking we might want to use
>> them.  When a getter and setter already exist, all it takes is the one
>> extra line of code, plus a suitable (unused) name for the property.  I
>> decided not to pursue traits (if at all) until we can use the Enthought
>> package as-is.  But I think that properties could be converted to traits
>> very easily if we wanted to do that in the future, so starting with
>> properties would not be wasted effort.  This is getting a bit off-topic,
>> though.
> 
> Minor note: if you are going to use properties, make sure all classes
> using them are new-style (inherit from object).  With old-style
> classes, properties fail in silent and mysterious ways that may lead
> to much head-scratching.

Not minor at all--I ran into exactly this problem a few months ago with 
my first foray into properties, and it did indeed take quite a bit of 
head-scratching before I realized the problem.  And I am embarrassed to 
say that I had forgotten about it until your reminder above.

Thanks.

Eric

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] units support in svn

2007-03-21 Thread John Hunter
On 3/21/07, Fernando Perez <[EMAIL PROTECTED]> wrote:

> And yes, properties are actually OK even with 2.2, so there's no
> reason to avoid them (and they do provide a nicer, claner user API).
> Decorators are 2.4-only though.

I'm not opposed to properties in principle -- I just didn't want to
start incorporating  them by happenstance.  We have the long running
unresolved issue of whether to use traits or properties, so I scrubbed
the properties as a foolish consitency, to stick to one design
approach until we have made a formal decision on how we want to
approach this, and then port mpl properties en masse.

But I think it would be a good idea to go ahead and derive Artist from
object to make sure this doesn't cause any troubles, and likewise for
the other top level classes, eg FigureCanvasBase and friends.

JDH

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] units support in svn

2007-03-21 Thread Fernando Perez
On 3/21/07, John Hunter <[EMAIL PROTECTED]> wrote:
> On 3/21/07, Fernando Perez <[EMAIL PROTECTED]> wrote:
>
> > And yes, properties are actually OK even with 2.2, so there's no
> > reason to avoid them (and they do provide a nicer, claner user API).
> > Decorators are 2.4-only though.
>
> I'm not opposed to properties in principle -- I just didn't want to
> start incorporating  them by happenstance.  We have the long running
> unresolved issue of whether to use traits or properties, so I scrubbed
> the properties as a foolish consitency, to stick to one design
> approach until we have made a formal decision on how we want to
> approach this, and then port mpl properties en masse.

I wasn't really voting for properties or traits, that decision is
ultimately your call.  They both provide similar user-visible benefits
(traits having more open-ended possibilities, of course).

> But I think it would be a good idea to go ahead and derive Artist from
> object to make sure this doesn't cause any troubles, and likewise for
> the other top level classes, eg FigureCanvasBase and friends.

Yes.  I fail to understand why the python VM doesn't raise an
exception of some kind when property() is called on an old-style
class.  It won't work anyway, so why the hell does it fail silently???
 I'm sure Eric and I are not the only people to have wasted time on
that particular trap.

Cheers,

f

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel