On 2014-03-19 23:53, Curtis Maloney wrote:
>
>
> On 20 March 2014 08:58, Florian Demmer <
fde...@gmail.com
sorry, is that discussion online somewhere to read up on the reasoning?
let me be clearer about what i find could be improved. it's the first
half of Łukasz's 2:
- a @property cannot be deleted on the instance (you can on the class),
AttributeError, that's ok.
- a normal property can be deleted and if deleted *again* of course
raises an AttributeError. it's not there, you cannot delete it. also good.
- @cached_property raising when deleting *again* is therefore reasonable.
- what i found surprising for a second, was that it raises the error,
when it was never accessed. it makes sense technically speaking of
course. the instance attribute just isn't set when the decorated method
wasn't accessed.
so seeing @cached_property as a mix of actual attribute and @property,
the behavior makes sense. seeing it as a caching mechanism not so much imho.
so what do i want?
maybe just a mention of the "never accessed" behavior in
https://docs.djangoproject.com/en/dev/ref/utils/
on the other hand i'd like to have safe, clean cache invalidation
without lots of boilerplate every time i need to invalidate a
@cached_property.
... and so i was curious about a patch doing something else, if there
were one already written but just not submitted.
br
Florian