Given that we now have TK_WILDCARD in GDScript, and _ is officially banned as a variable ( @karroffel ), I would like to request to be able to write this:
func handler(_, _):
pass # Might actually complete this function one day
Instead of:
func handler(discard = null, discard2 = null):
pass # Might actually complete this function one day
It's not merged yet btw.. 😄
@karroffel My bad -- anyway, I guess it would be merged given the community response on that other issue...
I still need reduz consent 😄
The PR #7583 has been merged by Akien a day ago. So this is a valid issue now.
I'm for pythonic
func handler(*args):
pass
or even
func handler(*_):
pass
````
in case of wildcard.
Python btw pack `*args` in this way:
```python
def a(*args, **kwargs):
print args, kwargs # [1,2] {'x':3, 'y':4}
a(1,2,x=3,y=4)
I prefer pythonic if we need to add this feature too
On Jan 24, 2017 13:33, "Yasha Borevich" notifications@github.com wrote:
I'm for pythonic
func handler(*args):
passor even
func handler(*_):
passin case of wildcard.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/7599#issuecomment-274857156,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF-Z21LKNune0boguhd0vjGFUjKh-BuCks5rVifSgaJpZM4LqHHh
.
I'm not speaking about varagrs, I'm speaking about using _ as a parameter name, to make an ignored value. i.e. for stuff like func do_stuff(_, second_param) over func do_stuff(something_not_going_to_be_used, second_param)
I think it's worth adding. It's making use of the new token and if (ever 😢) the lambda PR gets merged then this
var f = func(x,_): x
looks a lot sexier than
var f = func(x, y): x
because it's clear from the argument list that only the first param will be used.
I might take a look at how easy it is to implement that.
Most helpful comment
I'm not speaking about varagrs, I'm speaking about using
_as a parameter name, to make an ignored value. i.e. for stuff likefunc do_stuff(_, second_param)overfunc do_stuff(something_not_going_to_be_used, second_param)