Pythonic style

Christopher Reimer christopher_reimer at icloud.com
Thu Apr 28 00:03:58 EDT 2016


On 4/27/2016 8:52 PM, Ethan Furman wrote:
>
> The point Ben was trying to make is this:  you should never* call 
> __dunder__ methods in normal code; there is no need to do so:
>
> - use len(), not __len__()
> - use next(), not __next__()
> - use some_instance.an_attribute, not 
> some_instance.__dict__['an_attribute']
>

DOH! I need a doughnut. :)

Thank you,

Chris R.



More information about the Python-list mailing list