About 50 results
Open links in new tab
  1. python - What does functools.wraps do? - Stack Overflow

    Nov 21, 2008 · Yep, I prefer to avoid the decorator module since functools.wraps is part of the standard library and thus doesn't introduce another external dependency. But the decorator module does …

  2. python - How does functools partial do what it does? - Stack Overflow

    The (partial) function classify_diabetes() is created from the function classify_data() by currying (using functools.partial()). The later function does not require the data to be passed anymore and we can …

  3. python - What is the difference between partial and partialmethod ...

    Mar 16, 2017 · I found out that functools module of Python 3 has two very similar methods: partial and partialmethod. Can someone provide good examples of using each one?

  4. python - Python3 pass lists to function with functools.lru_cache ...

    Mar 10, 2018 · I want to cache a function that takes a list as a parameter, but when I try to do so with the functools.lru_cache decorator, it fails with TypeError: unhashable type: 'list'. import functools @fun...

  5. python - How does the functools cmp_to_key function work ... - Stack ...

    In Python, both list.sort method and sorted built-in function accepts an optional parameter named key, which is a function that, given an element from the list returns its sorting key. Older Python

  6. function - Python functools partial efficiency - Stack Overflow

    Jun 30, 2013 · Function call overhead in Python is relatively high, especially compared with the execution speed of a builtin function. - Is the partial function just forwarding the parameters to the …

  7. Python: Why is functools.partial necessary? - Stack Overflow

    functools.partial 's returned function is decorated with attributes useful for introspection -- the function it's wrapping, and what positional and named arguments it fixes therein.

  8. python - Differences between functools.partial and a similar lambda ...

    The practical differences between lambda and functools.partial in the common use cases seems to be functools.partial needs an import, lambda does not. The function definition for functions created with …

  9. How to use filter, map, and reduce in Python 3 - Stack Overflow

    Nov 30, 2012 · Why are the results different? How can I get Python 3 code to work like the Python 2 code did? See also: What is the problem with reduce ()? for specific motivation for the change to put …

  10. python - How can I use functools.singledispatch with instance methods ...

    Jul 7, 2014 · Python 3.4 added the ability to define function overloading with static methods. This is essentially the example from the documentation: from functools import singledispatch class …