On 3/2/2023 5:53 PM, Greg Ewing via Python-list wrote:
On 3/03/23 9:54 am, Ian Pilcher wrote:
I haven't found
anything that talks about which form is considered to be more Pythonic
in those situations where there's no functional difference.
In such cases I'd probably go for type(x), because it looks less
ugly.
x.__class__ *might* be slightly more efficient, as it avoids a
global lookup and a function call. But as always, measurement
would be required to be sure.
Except that we don't know if "efficiency" - whatever that might mean
here - matters at all.
--
https://mail.python.org/mailman/listinfo/python-list