Alex Martelli <aleax at aleax.it> wrote in message news:<mailman.1051689777.10470.python-list at python.org>...
> <snip> Indeed if we were able to
> classify the current behavior as "a bug" in some respect, AND give
> a patch that breaks no currently designed-in behavior, yet "fixes the
> bug" and makes super more useful to you, then that's the kind of
> fix that COULD go in 2.3 beta 2 (new functionality won't, but in
> some sense it might be considered "a bug" if super violates the
> normal expectations of clearly-advanced users such as you).
> <snip>
> Maybe we should break this thread in two -- one about metaclasses
> and one about super -- with suitable subjects... I do not understand
> where the 'bugs' of the two may be related nor actually what they
> really have to do with "accessing class-attributes" except in the
> vaguest, broadest sense.
> <snip>
> Yes, maybe we should separate super-issues and metaclass-issues
> and find a sharp example in each case of where reasonably expected
> behavior from docs, and observed behavior in 2.3 beta 1, differ. I
> think it does not need to be a "reasonable use case": that would be
> needed if we were arguing for EXTRA functionality of course -- but
> then it would go in 2.4 so there's no hurry, to say the least. If we're
> arguing there are BUGS, so the fixes could go in 2.3, then just a
> way to show up each bug clearly should suffice (hopefully).
>>> Alex
I do agree with you. Speaking about wanted functionality (maybe for
2.4)
I would like very much a __superclass__ attribute. Example: now I can
do
(NOTICE: in p23b)
class B(object): pass
class C(B): pass
c=C()
super(C,c).__thisclass__() #=> C
super(C,c).__self_class__() #=> C
I would like to have an additional attribute (not a method)
returning the superclass of C, in this case B:
super(C,c).__superclass__ #=> B
For instance I could do
b=super(C,c).__superclass__()
returning an instance of B.
I think Bjorn would we happy with this, too.
Certainly the documentation in
http://www.python.org/dev/doc/devel/lib/built-in-funcs.html
has to be changed. It says:
"""
super(type[object-or-type])
Return the superclass of type. If the second argument is omitted
the super object returned is unbound. If the second argument is an
object, isinstance(obj, type) must be true. If the second argument is
a type, issubclass(type2, type)
must be true. """
But it DOES not return the superclass! I admit I myself at the
beginning
was confused.
Michele