A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-June/036200.html below:

[Python-Dev] Sneaky 'super' instances

[Python-Dev] Sneaky 'super' instancesRaymond Hettinger python@rcn.com
Wed, 11 Jun 2003 18:12:52 -0400
[Raymond]
> > That is a reasonable short-term solution but it should go 
> > one layer down in ismethoddescriptor().  Append the line:
> > 
> >     and not isinstance(object, super)
> >

[Brett]
> Even though it is a non-data descriptor?  It seems to have a __get__ 
> instead of a __call__ method.  The problem is that pydoc just classifies 
> it as a descriptor first and assumes __name__ will be there.

Either way is fine.

My way solves the original problem and defines methoddescriptor
as a non-data descriptor that isn't super.  I think that matches what 
people expect when calling that inspect.ismethoddescriptor().

OTOH, if methoddescriptor is viewed as synonymous with
non-data descriptor, then, technically a super object should
return True and your fix will have to go inspect.isroutine().

Name your poison.  Add a test case.  Then fix it.


Raymond




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4