FixedPoint

Mark McEahern marklists at mceahern.com
Fri Feb 8 01:01:43 EST 2002


[Tim Peters]
> Note that I said "non-numeric object".  FixedPoint supports a rich set
> of auto-coercions from types that "make sense".  I'm not a fan of
> semantically senseless comparisons, e.g.
>
> >>> 5 < '5'
> 1

[Brian Quinlan]
> Even if you disagree with that example, I would argue that equivalence
> is a special case. If you cannot convert a => b in a meaningful way then
> a != b.

I've already solved my problem.  I appreciate the discussion--I've learned a
lot from it.

I can see Tim's point about how comparing a FixedPoint instance to None like
this doesn't make sense:

	if f == None:

However, the code that's doing this isn't under my control.

As a practical matter, I was faced with these options:

1) Change a third party source that we use heavily (PyPgSql, where the
comparison to None is made).
2) Change a third party source that is not maintained (FixedPoint) where the
fix is not likely to break anything.
3) Subclass the third party source and make the fix there.

I choose 2.  Since we use CVS, I just did cvs import on a folder with
FixedPoint, which creates a branch where the source lives.  Then I made my
simple modification to __cmp__ and checked it into the trunk.

Thanks,

// mark





More information about the Python-list mailing list