Hacker News new | past | comments | ask | show | jobs | submit login

I've been talking with a few developer friends about libraries lately, and this one has made me realize what they're saying. As Python developers, DSLs are completely not in our DNA, but this library strikes me as something that would look much more Pythonic with a DSL.

Wouldn't it be better to have descriptions of:

Every day at 10:30 do myfunc

Every Monday do otherfunc

Every hour do whatever

Rather than the current .every().day.at("10:30").do(myfunc)?




I find it hard to appreciate these inventive types of API design. Something more traditional and boring, like Celery's crontab[1] or dateutils rrule[2] seem quite sufficient. For example:

   crontab(hour=18, minute=30, day_of_week='*')
[1]: http://celery.readthedocs.org/en/latest/userguide/periodic-t...

[2]: https://labix.org/python-dateutil#head-470fa22b2db72000d7abe...


I'm not sure why, given two equally flexible designs, we should choose the least expressive. The fact that cron is sufficient doesn't mean I don't still have to google how to run things every three hours every second Monday, for example.


I agree. This scheduler dialect for Rebol is pretty much the DSL you describe - http://softinnov.org/rebol/scheduler.shtml


I'd rather have neither. I particularly dislike the .every().day.at("10:30").do(myfunc) thing where methods and attributes are abused in order to artificially make it read like a sentence.

This is not Pythonic at all <troll>it's like some childish Ruby code</troll>


What specifically do you think makes this un-Pythonic? It's very readable.


That's not a very constructive reply.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: