New submission from Peter Waller <[email protected]>:
Apologies if there is a way of doing this, but I haven't been able to find
anything.
I need to be able to do the following:
my_tuple = namedtuple("my_tuple", "a b c")
obj = my_tuple(1,2,3)
if isinstance(obj, namedtuple):
.. do stuff ..
The best I could come up with for the moment is:
if isinstance(obj, tuple) and type(obj) is not tuple:
.. do stuff ..
----------
messages: 98437
nosy: pwaller
severity: normal
status: open
title: No way to find out if an object is an instance of a namedtuple
versions: Python 2.6
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com