On 22-2-2017 8:39, Argentinian Black ops lll wrote:
> Thanks for the quick response...! you saved me a lot of time, thank you!
>
I don't know if you want/have to use your own custom caching decorator, but are
you
aware of the lru_cache decorator that's part of the standard library?
On Wed, Feb 22, 2017 at 8:16 AM, Pavol Lisy wrote:
> Maybe this technique could be reusable (and maybe part of functools?)
>
> With this decorator:
>
> def wrap_args(decorator):
> def decor_out(*args, **kwargs):
> def decor_in(func):
>
On 2/22/17, Steve D'Aprano wrote:
> On Wed, 22 Feb 2017 08:47 pm, Cecil Westerhof wrote:
>
>> On Wednesday 22 Feb 2017 08:49 CET, Argentinian Black ops lll wrote:
>>
>>> *** SOLVED ***
>>
>> It would be nice if you shared the solution.
>
> I believe Cameron's post
On Wed, 22 Feb 2017 08:47 pm, Cecil Westerhof wrote:
> On Wednesday 22 Feb 2017 08:49 CET, Argentinian Black ops lll wrote:
>
>> *** SOLVED ***
>
> It would be nice if you shared the solution.
I believe Cameron's post contains the bones of a solution.
Here's my untested solution.
def
On Wednesday 22 Feb 2017 08:49 CET, Argentinian Black ops lll wrote:
> *** SOLVED ***
It would be nice if you shared the solution.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
--
https://mail.python.org/mailman/listinfo/python-list
*** SOLVED ***
--
https://mail.python.org/mailman/listinfo/python-list
Thanks for the quick response...! you saved me a lot of time, thank you!
--
https://mail.python.org/mailman/listinfo/python-list
On 21Feb2017 22:44, alfredocabre...@gmail.com wrote:
I have a python function and a decorator that works just fine.
def fun_cache(function):
memo = {}
def wrapper(*args):
if args in memo:
return memo[args]
else:
rv =
I have a python function and a decorator that works just fine.
def fun_cache(function):
memo = {}
def wrapper(*args):
if args in memo:
return memo[args]
else:
rv = function(*args)
memo[args] = rv
return rv
return wrapper
I just created an account to contribute to the wiki.python.org Python
Decorator Library Wiki. I added my code titled == Memoize Objects ==
using the Wiki editor. The preview looked good. Then i submitted
it. However, it is not showing up on the Wiki. I could not find
contact info
On Wed, 30 May 2012 07:51:32 -0700, marctbg wrote:
I just created an account to contribute to the wiki.python.org Python
Decorator Library Wiki. I added my code titled == Memoize Objects ==
using the Wiki editor. The preview looked good. Then i submitted it.
However, it is not showing up
Hi all,
The following is what I want to do, but this results in a syntax
error:
@news_page('template.html').lookup(News, 'news_id', 'news')
def view(request, group, news):
pass
What does work is the equivalent old way of doing decorating:
def view(request, group, news):
pass
view =
On Jan 18, 8:44 am, Jonathan S jonathan.slend...@gmail.com wrote:
Hi all,
The following is what I want to do, but this results in a syntax
error:
@news_page('template.html').lookup(News, 'news_id', 'news')
def view(request, group, news):
pass
What does work is the equivalent old way
On 01/19/10 03:44, Jonathan S wrote:
Any suggestions? I have my reasons for doing this, (news_page is a
class, and __call__ is used to wrap the template.)
I'm sure this is a limitation in the syntax, but would parenthesis
somewhere help?
The restriction[1] is put in there since Guido has a
Jonathan S wrote:
Hi all,
The following is what I want to do, but this results in a syntax
error:
@news_page('template.html').lookup(News, 'news_id', 'news')
def view(request, group, news):
pass
What does work is the equivalent old way of doing decorating:
def
In article 4b54998...@dnews.tpgi.com.au,
Lie Ryan lie.1...@gmail.com wrote:
If you are sure you can put up a convincing argument for lifting this
restriction, and you are willing to put some time arguing, you are
welcome to start a thread in the python-dev mailing list. Be sure to
read about
a...@pythoncraft.com (Aahz) writes:
In article 4b54998...@dnews.tpgi.com.au,
Lie Ryan lie.1...@gmail.com wrote:
If you are sure you can put up a convincing argument for lifting this
restriction, and you are willing to put some time arguing, you are
welcome to start a thread in the python-dev
Thanks a lot, all of you! This was really helpful. (or at least give
me the inspiration I needed to finish it.)
I'm sure this is a use case where most other options are less readable
than the chain of methods in the decorator.
In this use case, I had a lot of Django views to which access
Hello,
I am writing to point interested readers to a few short articles on
decorators:
Please find them here:
http://muharem.wordpress.com/2006/10/18/3/
Best regards -- Muharem
--
http://mail.python.org/mailman/listinfo/python-list
19 matches
Mail list logo