default arguments newbie question

Mike Fletcher mfletch at tpresence.com
Thu Jan 11 00:22:33 EST 2001


Don't know that I'd call this pathological, merely obscure.  On the other
hand, there are people who have decided every piece of code I write is
pathological, so you may be ultimately correct in your classification :o) .

There are significant reasons for creating such objects (how do you model an
object that's supposed to be None-like, but requires some extra feature that
None doesn't provide).  Without type-subclassing, such approaches are
occasionally employed.  When they are employed, the people using such
systems find that x is None tests all have to be changed to x == None to
allow the new objects to work.  Once we get rid of the type-class split
we'll have to deal with this all over again (Does None get special "is"
testing so that all sub-class instances are considered equal?  then how do
we test the difference between them?)

That is, they two statements have semantic inequality.  One tests the
address and tests pointer equality, the other specifies that two objects
have the same "value"...

    PyObject * x,y;
    (x == y) != (&x == &y);

Where the actual test for value is some byzantine series of checks for slots
and calls and reverse calls and such that allow an object to define whatever
testing it likes.

My observation was that the original poster wouldn't likely care, not that
no-one should care.  We all love the little folds and twists of Python, it's
what makes it such a lovable, squeezable creature...
:)

Enjoy,
Mike

-----Original Message-----
From: Erik Max Francis
To: python-list at python.org
Sent: 1/10/2001 11:33 PM
Subject: Re: default arguments newbie question

Mike Fletcher wrote:
<obscure and obviously misleading discussion by some wacko, you're better
off never reading it, trust us>

Well, sure, you can come up with pathological cases, but as you say, it
isn't terribly important as a serious technical objection.

...




More information about the Python-list mailing list