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

Note that that "location" property should be a method instead of property to signal that it does something potentially complex and slow. Making it a property practically guarantees that someone will use it in a loop without much second thought, and that's how you get N+1.


Fair point! one of various @cached_property decorators might fix this, depending on the precise use case, but yeah this is an important consideration when defining your API.




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

Search: