I think this is because functools.partial is written as C
extension.
You can't get the code object from them for inspection. But
you still
can call them, get/set custom attributes, get the curried
function as
func attribute, get curried args from args attribute and
curried
keyword arguments from keywords attribute. So they still can
be
inspected but in different way. The cost of speed.
On 25 ΔΕΛ, 02:34, "Jeremy Dunck" <jdu... gmail.com> wrote:
> On Dec 24, 2007 4:17 PM, Ivan Illarionov
<ivan.illario... gmail.com> wrote:
>
>
>
>
>
> > I suggest using python 2.5 standard library
functools.partial when it
> > is available instead of
django.utils.functional.curry. This functions
> > are technically the same with the exception that
partial is written in
> > C and is about 2 times faster.
>
> > Just replace every:
> > from django.utils.functional import curry
>
> > with
> > try:
> > from functools import partial as curry
> > except ImportError: #Python 2.3 and 2.4 fallback
> > from django.utils.functional import curry
>
> > Note that benchmarks in previous post was
*without* that change.
>
> I'm not sure why, but the objects returned by
functools.curry can't be
> inspected and are simply not normal python callables.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django developers" group.
To post to this group, send email to django-developers googlegroups.com
To unsubscribe from this group, send email to
django-developers-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---
|