Really stupid question regarding PEP 252 and type/class unification
russell_turpin at hotmail.com
Thu Aug 23 16:07:02 CEST 2001
>> The variable "spam" is an Integer, "Integer" is now a class
>> (unification, right?), so there should be *some* attribute
>> of the class Integer, lets call it __myval__, such that:
>> spam.__myval__ == 3
Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> wrote in message news:<slrn.pl.9o8cfs.2om.qrczak at qrnik.zagroda>...
Well .. the hope of unification is that everything follows the
same set of rules. What's a little bothersome about 252 is
that types are *almost* classes, except (among other things)
their instances carry around this extra information that can
be reached *only* by their unadorned name. Maybe that's not
bad. As you point out:
> In designing an "everything is a [...]" type of framework
> (e.g. everything is an object, or a function) there must
> be a place where the ideal abstract recursive structure of
> the world breaks somehow.
The question, in this kind of endeavor, is: "How do you
ground the uniform, recursive rule in the simplest way
possible, i.e., without introducing too many new rules for
the ground objects?"
Terry J. Reedy writes:
> This pep and the next can make one's head spin even without
> cold meds.
Yeah, and that's what really bothers me. At the end of the
day, I want the Python type model to be so simple that I can
write its rules on a single page. Type and class unification
*should* be a step toward that, not just a way to add more
features. Yeah, it's neat to derive classes from types. But
unification should bring much more than that. And maybe it
does. I haven't tried to write out the new type model, and
when Guido does it, I expect it to be really neat. I'm just
sort of probing around the edges of where the grounding occurs,
and I'm wanting to see something very simple there.
So here are some questions. Suppose I derive a class from
a base type:
myInt = MyInt()
myInt = 5 # Will this work?
Now I type "myInt" into the interpreter. Does it print out:
Or does it print:
<instance of MyInt>
More information about the Python-list