Hacker News new | ask | show | jobs
by wting 4467 days ago
Using _ as a throwaway variable name is idiomatic in Python, Haskell, and Go. Looks like they're pushing the same idiom in Hack, which I'm ok with.
3 comments

AFAIK in Haskell it's not a throwaway variable, a pattern with _ will not create a binding at all. I don't think Python does this, maybe Go.
Python doesn't have language support for the idiom -- trying to evaluate

lambda _, _: None

gives

SyntaxError: duplicate argument '_' in function definition

but tools like pylint will silence unused-variable warnings if the variable starts with '_'.

Thanks for the verification. But even a bit of syntactic convention won't be enough if python create a unnecessary binding.
And Ruby, and Rust. It's close to universal.
And Clojure.