I have a little helper class: This lets me do sweet magic like: without having to use a list comprehension (as in np.array(x in (2,3) for x in arr). (I maintain a UI that lets (trusted) users type in arbitrary code, and a == AnyOf(1,2,3) is a lot more palatable than a list comprehension to the non-technically savvy user.) However!
Tag: python-datamodel
How to get method parameter names?
Given that a function a_method has been defined like Starting from a_method itself, how can I get the argument names – for example, as a tuple of strings, like (“arg1”, “arg2”)? Answer Take a look at the inspect module – this will do the inspection of the various code object properties for you. The other results are the name of