4 ms·
I'm not sure why click is often recommended. I've used argh for years and find it easier: def hello(name): return "hello {}".format(name) def ping
by guggle 7y ago
I'm not sure why click is often recommended. I've used argh for years and find it easier:
def hello(name):
return "hello {}".format(name)
def ping():
return "pong"
if __name__ == "__main__":
import argh
parser = argh.ArghParser()
parser.add_commands([hello, ping])
parser.dispatch()
- rch 7y agoIf people in your organization tend to write Flask apps, then you might find click in standalone scrips as well.
- guggle 7y agoI'm not sure why Flask is often recommended either. It seems to me that it's somewhere between Bottle and Django, playing the strange role of a not-so-lightweight, not-so-unopiniated framework. But I should probably reserve this rant for another thread.
- diminoten 7y agoWhy format()?
- guggle 7y agoI like it. Maybe because it's explicit. I never liked the old % style. I may switch to f-strings one day. So much for "There should be one-- and preferably only one --obvious way to do it."
- BerislavLopac 7y agoThe key word in that line is "obvious".
- diminoten 7y agoSo you're comfortable using something because you like it?
- guggle 7y agoOf course.
- diminoten 7y agoDo you work with others? Do you code professionally?
- guggle 7y agoSure.
- diminoten 7y agoWhen you do things you like, how does it impact others?
- guggle 7y agoYou mean things as trivial as string format methods ? No impact. This is not subject to discussion either, we avoid bikeshedding.
- diminoten 7y agoSo there are topics that are "not subject to discussion" and they're also the decisions you get to unilaterally make based on your preference, with no explanation needed. Sounds fun, great coworking environment.
- dang 7y agoNot sure what's going on, but you've posted so many low-quality comments and broken the site guidelines so many times in the last several hours that I'm rate-limiting your account again, until we get a commitment that this will stop and not recur.
- comradesmith 7y agoWow argh looks great! I'll definitely try swapping one of my tools to argh
- mixmastamyk 7y agoNo stacked decorators, nice.
- ekimekim 7y agoYep, this is my first time seeing Click and it looks very similar to argh. Personally I'll probably stick to argh, but good to see some competition in the space. One nice thing about argh is that it's mostly just a fancy wrapper around argparse. So you have the full functionality of argparse if you need it, while still getting the lack of boilerplate and nice defaults of argh. It also means it works with other third party things on top of argparse like argcomplete for tab completion. Does anyone know if Click is similar, or if it implements its own parser? EDIT: Answered my own question. Looks like it uses optparse internally. So yeah, should see similar benefits.