In python, there are some built-in classes that are not normally accessible such as Code, NoneType, and Generator. This question asks about some of these, and the answer essentially seems to be "don't worry about it." However, I specifically want to check if an object passed to my function is a generator function. Currently the relevant structure of my code is as follows.
def dummyGen_():
yield None
Generator = type(dummyGen_())
def myFunct(gen):
g = gen()
assert type(g) is Generator
# rest of the code #
However defining a useless generator that doesn't do anything just to get to its type feels awkward, and I just don't like it. Is there a better, more pythonic way of going about this? Or am I doomed to just create a random generator just to access it's type?