Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #112132 > unrolled thread
| Started by | Stefan Behnel <stefan_ml@behnel.de> |
|---|---|
| First post | 2016-07-31 10:39 +0200 |
| Last post | 2016-07-31 10:39 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: usage of functools.partial in in parallelism Stefan Behnel <stefan_ml@behnel.de> - 2016-07-31 10:39 +0200
| From | Stefan Behnel <stefan_ml@behnel.de> |
|---|---|
| Date | 2016-07-31 10:39 +0200 |
| Subject | Re: usage of functools.partial in in parallelism |
| Message-ID | <mailman.72.1469954383.6033.python-list@python.org> |
Sivan Greenberg schrieb am 30.07.2016 um 23:15: > I'm wondering about the use of partial in writing parallel code. Is is it > quicker than re-evaluating arguments for a multiple session.get()'s method > with different , for example (of requests) ? > > Or maybe it is used to make sure the arguments differ per each invocation > ? (the parallel invocation is supposedly using tasks / co-routine support > in Python 3. > > I can't publish the code I spotted that in. > > What are ups and downs of using them when are they in context? I'm having difficulties in understanding what exactly you are asking here and what you are comparing it with, but partial() is just a way of saying "I want a single thing that calls *this* function with at least (or exactly) *these* arguments whenever I call it". It's basically binding a function and some arguments together into a nice package that the eventual caller doesn't have to know any special details about. There is more than one way to do that, but partial is a quick and straight forward one that is commonly and widely used. Also for entry points when running code in parallel or concurrently, but there's really nothing special about that use case. Does that answer your question? Stefan
Back to top | Article view | comp.lang.python
csiph-web