Re: [Zope3-Users] Re: Interface tests: NotImplemented or NotImplementedError

2005-10-27 Thread Fred Drake
On 10/24/05, Chris Withers <[EMAIL PROTECTED]> wrote:
> Well, if we're all in agreement, what's required for it to actually
> change? ;-)

Someone with time, motivation, a detailed plan, and the ability to
convince Guido.

Most of the difficulty is in actually removing the NotImplemented name
from __builtin__, since that can break too much.  The rest is likely
just editing.  And agreeing on a new name.  :-)


  -Fred

--
Fred L. Drake, Jr.
"Society attacks early, when the individual is helpless." --B.F. Skinner
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Interface tests: NotImplemented or NotImplementedError

2005-10-24 Thread Chris Withers

Fred Drake wrote:

On 10/21/05, Chris Withers <[EMAIL PROTECTED]> wrote:


At the very least NotImplementedComparision or
NotImplementedOperandForType would be more explicit...


Indeed.  We (and many others in the Python community) are in complete
agreement on this.


Well, if we're all in agreement, what's required for it to actually 
change? ;-)


Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Interface tests: NotImplemented or NotImplementedError

2005-10-21 Thread Fred Drake
On 10/21/05, Chris Withers <[EMAIL PROTECTED]> wrote:
> At the very least NotImplementedComparision or
> NotImplementedOperandForType would be more explicit...

Indeed.  We (and many others in the Python community) are in complete
agreement on this.


  -Fred

--
Fred L. Drake, Jr.
"Society attacks early, when the individual is helpless." --B.F. Skinner
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Interface tests: NotImplemented or NotImplementedError

2005-10-21 Thread Chris Withers

Fred Drake wrote:

On 10/20/05, Chris Withers <[EMAIL PROTECTED]> wrote:


What an unfortunate name, I'd have called it Uncomparable on some such...


While the current name is unfortunate, and Uncomparable would make the
two easier to distinguish, Uncomparable would also be wrong.  (If a
comparison cannot be performed between two objects, that should be an
exception.)  This value is only used to indicate that the comparison
is not implemented by the specific method chosen; the other operand
may well implement the comparison.  This is done to allow third-party
numeric types to be implement comparison with the built-in types in
meaningful ways, instead of the outcome of the comparison being
dependent on the order of the operands.


Sorry, I meant some-other-less-confusing-name, not that the one I 
suggested was the right one ;-)


At the very least NotImplementedComparision or 
NotImplementedOperandForType would be more explicit...


cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Interface tests: NotImplemented or NotImplementedError

2005-10-20 Thread Fred Drake
On 10/20/05, Chris Withers <[EMAIL PROTECTED]> wrote:
> What an unfortunate name, I'd have called it Uncomparable on some such...

While the current name is unfortunate, and Uncomparable would make the
two easier to distinguish, Uncomparable would also be wrong.  (If a
comparison cannot be performed between two objects, that should be an
exception.)  This value is only used to indicate that the comparison
is not implemented by the specific method chosen; the other operand
may well implement the comparison.  This is done to allow third-party
numeric types to be implement comparison with the built-in types in
meaningful ways, instead of the outcome of the comparison being
dependent on the order of the operands.


  -Fred

--
Fred L. Drake, Jr.
"Society attacks early, when the individual is helpless." --B.F. Skinner
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Interface tests: NotImplemented or NotImplementedError

2005-10-20 Thread Chris Withers

Fred Drake wrote:

A rich-comparison method should return NotImplemented to indicate that
it doesn't implement the specific comparison; the response should be
for Python to allow the other operand a chance to handle the
comparison (inverted, of course).


Oh :-(

What an unfortunate name, I'd have called it Uncomparable on some such...

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Interface tests: NotImplemented or NotImplementedError

2005-10-19 Thread Fred Drake
On 10/19/05, Chris Withers <[EMAIL PROTECTED]> wrote:
> What's the correct use case for the NotImplemented singleton?

A rich-comparison method should return NotImplemented to indicate that
it doesn't implement the specific comparison; the response should be
for Python to allow the other operand a chance to handle the
comparison (inverted, of course).


  -Fred

--
Fred L. Drake, Jr.
"Society attacks early, when the individual is helpless." --B.F. Skinner
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Interface tests: NotImplemented or NotImplementedError

2005-10-19 Thread Chris Withers

Fred Drake wrote:

Definately!  The similar naming of these two built-ins has been an
endless cause for confussion.


What's the correct use case for the NotImplemented singleton?

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Interface tests: NotImplemented or NotImplementedError

2005-10-18 Thread Fred Drake
On 10/18/05, Michel Pelletier <[EMAIL PROTECTED]> wrote:
> NotImplemented is a singleton object, introduced in 2.1 (I think), used
> for rich comparision:
>
> http://www.python.org/peps/pep-0207.html
>
> I suspect (although I'm often wrong!) the author of the book you are
> reading might have used it incorrectly.
>
> NotImplementedError is an exception to raise to indicate that a feature
> or method is not implemented.  It's probably the one you want.

Definately!  The similar naming of these two built-ins has been an
endless cause for confussion.


  -Fred

--
Fred L. Drake, Jr.
"Society attacks early, when the individual is helpless." --B.F. Skinner
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: Interface tests: NotImplemented or NotImplementedError

2005-10-18 Thread Michel Pelletier



In the Zope 3 book the method is like this:

def makeTestObject(self):
   raise NotImplemented()


...


Looking in some real zope3 tests I saw another version of the method:

def makeTestObject(self):
   raise NotImplementedError()



NotImplemented is a singleton object, introduced in 2.1 (I think), used 
for rich comparision:


http://www.python.org/peps/pep-0207.html

I suspect (although I'm often wrong!) the author of the book you are 
reading might have used it incorrectly.


NotImplementedError is an exception to raise to indicate that a feature 
or method is not implemented.  It's probably the one you want.


-Michel

[EMAIL PROTECTED]

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users