#10479: Use funtools.partial instead of django.utils.functional.curry
-----------------------------+----------------------------------------------
 Reporter:  sebastian_noack  |       Owner:  nobody    
   Status:  new              |   Milestone:            
Component:  Uncategorized    |     Version:  1.0       
 Keywords:                   |       Stage:  Unreviewed
Has_patch:  0                |  
-----------------------------+----------------------------------------------
 Django's curry method is just an implementation of Python 2.5's (and
 above) partial class from the functools module. But because of
 functools.partial is implemented as C extension, it is way faster than
 django's implementation.

 {{{
 # python2.5 -m timeit -s 'from django.utils.functional import curry; f =
 curry(lambda x: x, "foo")' 'f()'
 100000 loops, best of 3: 2.27 usec per loop
 # python2.5 -m timeit -s 'from functools import partial; f =
 partial(lambda x: x, "foo")' 'f()'
 1000000 loops, best of 3: 0.417 usec per loop
 }}}

 So, is there a reason for not using partial instead of curry on Python2.5
 and above? We could introduce a funccompat module and use it the same way
 as the itercompat module for example.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10479>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to