The discussion about niladic functions, made me want to follow a segue and do some reflection/introspective programming in Python. I?ve not done a lot of that yet, and it seemed like an educational (well, at least entertaining) goose chase.
If I run the following code:
I will get an error (expected). The error I will get is:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: now() takes at most 1 argument (2 given)
So, at some point, there?s some metadata in the system attached to the builtin datetime.datetime.now method, that indicates 1 argument, tops.
So here?s my basic question. Is there anyway to programatically query that information in python code?
just gives a ValueError. inspect must only be good for the python code that I write, in python. Is there another way to dig out what the interpreter knows there?