-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Description
I have a wrapper this is nearly identical to the helper jsobj
, but I noticed today it falls short in one regard, which is that it doesn't have the full power of nameof
when it comes to getting the "full/base name" of the object that was put in.
What jsobj
does:
a, b = 1, 2
jsobj(a, b) # {'a': 1, 'b': 2}
What nameof
can do:
func.a.b = 1
nameof(func.a.b, vars_only=False) # 'func.a.b'
What I would like to have
a = 1
func.a.b = 2
some_function(a, func.a.b) # {'a': 1, 'func.a.b': 2}
Perhaps there could be a keyword keep_base
argument added to jsobj
along the lines of:
def jsobj(*args, keep_base=True, **kwargs): ...
I appreciate this would add a blind spot to the function.
Is something like this possible with the existing setup?
Metadata
Metadata
Assignees
Labels
No labels