Re: default object comparison considered harmful?



On May 16, 9:10 am, castironpi <castiro...@xxxxxxxxx> wrote:
On May 16, 8:35 am, castironpi <castiro...@xxxxxxxxx> wrote:





On May 16, 8:18 am, castironpi <castiro...@xxxxxxxxx> wrote:

On May 16, 7:23 am, Bruno Desthuilliers <bruno.

42.desthuilli...@xxxxxxxxxxxxxxxxxxx> wrote:
Kay Schluehr a écrit :

On 16 Mai, 10:03, "A.T.Hofkamp" <h...@xxxxxxxxxxxxxxxxxxxx> wrote:
Hello all,

Yesterday we found the cause of a bug that has caused problems for a long time.
It appeared to be the following:

class A(object):
    pass

print min(1.0, A())

which is accepted by Python even though the A() object is not numerical in
nature.

The cause of this behavior seems to be the compare operation of the object
class.

Is there a way to disable this behavior in Python (other than deriving a new
'object-like' class that doesn't do comparisons?)

Are you sure you don't want to use a statically typed language that
captures all type errors just by inspecting your source code?

This is not necessarily a static vs dynamic typing problem. The
following code will raise a TypeError for very good reasons:

    print 1.0 + A()- Hide quoted text -

- Show quoted text -

I question the real-world examples of coercion, casting, and
upcasting.  C insists that defining by operator, which may or may not
relate to system, is the only legal move.  I doubt operator+ is well-
defined on non-ideal structures.  Rationals are not floats, but system
got checked.  Define concurrency.- Hide quoted text -

- Show quoted text -

I would be bouncing localcy and remoticy.  What word's on the bar?- Hide quoted text -

- Show quoted text -

Can you suffixize words?  I have corner, cornercy, lunacy, emphatic,
emphasize, a value of Y, orderings, say, remoticy, & cross.  Come do
graphics.  Anybody speak?

For verbs, I have: say, speak, see, talk, and stack.  Pretty
harmless.  Still here?- Hide quoted text -

- Show quoted text -

That's stay tuned I'M BARTENDER. Is that a space BAR ZOOP.

.



Relevant Pages

  • Re: default object comparison considered harmful?
    ...     pass ... captures all type errors just by inspecting your source code? ... I would be bouncing localcy and remoticy. ... say, speak, see, talk, and stack. ...
    (comp.lang.python)
  • Re: default object comparison considered harmful?
    ...     pass ... captures all type errors just by inspecting your source code? ...
    (comp.lang.python)
  • Re: default object comparison considered harmful?
    ...     pass ... captures all type errors just by inspecting your source code? ...
    (comp.lang.python)
  • Re: Shun John Payton
    ... Too bad it is his head that is so deep in the sand this time. ...   No one talks of it unless they agree!! ... in very sophmoric fashion snit that we will not speak ... Just stay the hell away from me when you get shot or burned ...
    (alt.vacation.las-vegas)
  • Re: The Price is WRONG!!!!!!!!!!!!!!!!!
    ... On Sep 6, 3:50 pm, The Handelmaniac ... own feelings and let it all hang out,so to speak. ... star who is capable of totally demented singing. ...       My best, ...
    (rec.music.opera)