How to check if an object is an instance of a namedtuple?

后端 未结 7 1557
轮回少年
轮回少年 2020-12-08 18:39

How do I check if an object is an instance of a Named tuple?

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 19:04

    If you need to check before calling namedtuple specific functions on it, then just call them and catch the exception instead. That's the preferred way to do it in python.

提交回复
热议问题