Is it possible to make a function's keyword argument default defined to a variable name? I want to do this because I'm finding myself creating functions with a lot of keyword arguments, but I'd like these keyword arguments default to a variable name I define before using the function. I'm also open to solutions that allows me to fix the repetitiveness problem in other ways. this was just one idea i was musing about.
for instance, i'd like to do something like this
def do_something(x=x, y=y, z=z, t=t):
return x, y
I know the above returns an error because I haven't defined x yet.
i'm too lazy to constantly write:
x = 100
y= 50
z= 10
t= 1
do_something(x=x, y=y, z=z, t=t)
I'd rather just write with the defaults already assumed as the variable names:
x = 100
y= 50
z= 10
t= 1
do something()