How can I detect if the caller passed any variables to my function in Python?
Posted
by Felix Schwarz
on Stack Overflow
See other posts from Stack Overflow
or by Felix Schwarz
Published on 2010-03-27T13:49:31Z
Indexed on
2010/03/27
13:53 UTC
Read the original article
Hit count: 240
I guess the subject sounds pretty stupid, so I'll show some code:
def foo(**kwargs):
# How can you detect the difference between (**{}) and ()?
pass
foo(**{})
foo()
Is there any way to detect inside of foo, how the method was called?
© Stack Overflow or respective owner