blhsing
(Ben Hsing)
August 28, 2024, 3:16am
19
Alyssa Coghlan:
This is an interesting variation, but the dot is still pretty easy to miss. However, using @
could work:
my_function(
my_first_variable=@,
my_second_variable=@,
my_third_variable=@
)
It’s using it as a mnemonic for “the value stored AT the local variable with the same name as the parameter”, rather than indicating any relationship with function decorators or matrix multiplication.
As mentioned in my post in the other thread, we can use a dunder keyword instead of a symbol to make the code look less cryptic/more Pythonic, at the cost of brevity:
my_function(
my_first_variable=__same__,
my_second_variable=__same__,
my_third_variable=__same__
)
This has now evolved into a possible keyword __target_text__
per our discussion in that thread:
MyTuple = namedtuple(__target_text__, "a b c")
1 Like