What is the semantics meaning of 'object'?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Jun 23 21:27:36 EDT 2013


On Sun, 23 Jun 2013 15:24:14 -0400, Roy Smith wrote:

> In article <51c74373$0$29999$c3e8da3$5496439d at news.astraweb.com>,
>  Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
 
>> What else would you call a function that does lookups on the current
>> object's superclasses?
> 
> Well, mro_lookup() would have been a better choice.  Super() has an
> obvious meaning, which just happens to be wrong.

This "obvious but wrong" meaning isn't the least bit obvious to me. Care 
to give me a hint? The only thing I can think of is:

- if you are familiar with single inheritance;

- but unfamiliar with multiple inheritance;

- and you make the incorrect assumption that there can be only one 
superclass of a given class;

- then you might assume that super means "return the superclass of this 
class" (or possibly instance). 

I don't think that counts as "obvious". Or at least not "intuitive" :-)


In any case, I don't think that the name mro_lookup is appropriate. It's 
misleading because it suggests that you pass something to be looked up, 
like a class, or perhaps an attribute name:

mro_lookup(starting_class, target_class)

mro_lookup(starting_class, 'method_name')



-- 
Steven



More information about the Python-list mailing list