Add a LICENSE and a README
- ID
0e4bef3- date
2021-10-25 07:20:08+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
d01765e- message
Add a LICENSE and a README- changed files
Changed files
LICENSE (0) → LICENSE (1066)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..87db991
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 Alex Chan
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
README.md (0) → README.md (1327)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..656bf77
--- /dev/null
+++ b/README.md
@@ -0,0 +1,44 @@
+# concurrently
+
+I often use the following pattern in Python:
+
+```python
+for task in get_tasks_to_do():
+ perform(task)
+```
+
+Tasks run one after the other: task 1 runs to completion, then task 2 runs to completion, then task 3 runs to completion, and so on until everything is done.
+
+This is fine for certain classes of task, but if `perform()` is heavily I/O bound, it's unnecessarily slow.
+If I could run multiple instances of `perform()` concurrently, the overall process would complete much faster.
+Task 1 could start, make a network request, then task 2 could start while task 1 is waiting.
+
+I wrote [my recipe for concurrent processing][blog] in a blog post in 2019, but the code was a little cumbersome to use.
+This repo is a tidied up (and tested!) version of that code.
+
+It allows me to write code like:
+
+```python
+from concurrently import concurrently
+
+for (input, output) in concurrently(fn=perform, fn_inputs=get_tasks_to_do()):
+ print(input, output)
+```
+
+It yields both the input and the output, because results may not come in the original order of inputs.
+
+I would recommend using this code instead of the code in the original blog post.
+
+[blog]: https://alexwlchan.net/2019/10/adventures-with-concurrent-futures/
+
+
+
+## Usage
+
+Copy and paste the file `concurrently.py` into your project.
+
+
+
+## License
+
+MIT.