Rustom Mody wrote:

> My point was more methodological/sociological than technical:
> 
> Are these dunder methods as 'internal' as say the register-allocation used
> by a C compiler?


Dunder methods are implementation, not interface. If you are the class
author, then you care about the implementation, and write dunder methods.
But as the class user, you should not call dunder methods directly, instead
always go through the public interface:

# Not these.
a.__dir__()
seq.__len__()
x.__add__(y)
spam.__eq__(ham)

# Use these
dir(a)
len(seq)
x + y
spam == ham



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to