[Python-ideas] Unified style of cache management API

Serhiy Storchaka storchaka at gmail.com
Thu Mar 28 13:52:22 EDT 2019


28.03.19 19:45, Brett Cannon пише:
> So I would say that a cache-clearing function convention would be a 
> reasonable starting point. If that turns out to not be enough for folks 
> we can talk about expanding it, but I think we should start small and 
> grow from there as needed.
> 
> So what name would people want. clear_cache() or _clear_cache()? I 
> personally prefer the latter since clearing the cache shouldn't be 
> something people should typically need to do and thus the function is an 
> implementation detail.

This is an interesting idea. I think it should be a dunder name: 
__clearcache__() or __clear_cache__().

The disadvantage is that this method is slower in the case of large 
number of imported modules.



More information about the Python-ideas mailing list