79113342

Date: 2024-10-22 09:38:25
Score: 1
Natty:
Report link

A namedtuple has the _fields attribute.

I use:

def is_namedtuple(v: Any):
    return isinstance(v, tuple) and hasattr(v, "_fields")
Reasons:
  • Low length (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: MarcelloDG