Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I found this was the most compact way to represent what I wanted to define, and makes it easy to keep the type hints for parameters. If you look inside `@prompt` it's creating a `PromptFunction` instance which I think would be a similar API to what you would end up with without using decorators https://github.com/jackmpcollins/magentic/blob/afdb22513385b...


I never got on board of decorators in python, but you sold me on it.


Another really good use is performance metrics -- decorators to track execution time, for instance, with the ability to specify things like function groups, logic concepts, etc. It makes it trivial to add this sort of observability to your code.




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

Search: