Nov-06-2018, 08:01 AM
(This post was last modified: Nov-06-2018, 08:04 AM by Gribouillis.)
(Nov-06-2018, 12:55 AM)Skaperen Wrote: i suspect it is from python having the weakness of being unable to allow "user code" supporting dynamic typing the same way python itself can doWhat does it mean? I don't see where Python is unable to support dynamic typing. By the way, using a generic function, you can implement a
clen()
function that behaves exactly the way len()
does including using a __clen__()
attribute for user defined types. I would implement it but I still don't understand the result that you expect from a call to clen()
. Also note that officially, we should not implement new dunder methods by ourselves, just in case the python devs decide to have a __clen__
attribute someday in the future.