List of methods affected by 'Special method lookup'

Terry Reedy tjreedy at udel.edu
Mon Jan 28 20:21:31 EST 2019


On 1/28/2019 11:14 AM, Roberto Martínez wrote:
> Hi,
> 
> the documentation about Special method lookup
> <https://docs.python.org/3/reference/datamodel.html#special-method-lookup>
> claims:
> "For custom classes, implicit invocations of special methods are only
> guaranteed to work correctly if defined on an object’s type, not in the
> object’s instance dictionary. "
> 
> Does this statement holds for every special method mentioned in section 3.3
> Special method names
> <https://docs.python.org/3/reference/datamodel.html#special-method-names>?

You should generally take such statements at face value.  Unless you 
find specific exceptions mentioned elsewhere, 'no guarantee' means just 
that, regardless of how any particular implementation behaves today.
-- 
Terry Jan Reedy





More information about the Python-list mailing list