gaoxinge added the comment:
> I assume what you mean is that while shutdown will wait, it won't accept any
> new job/future after it is called.
Yes, you are right. This is a feature of the ThreadPoolExecutor.
--
___
Python tracker
gaoxinge added the comment:
The workflow is like below:
- executor submit wait_on_future, and return the future f
- executor call shutdown
- executor submit pow (because executor already call shutdown, this submit will
fail and raise a runtime error)
- then fail above will cause work thread
gaoxinge added the comment:
```
from concurrent.futures import ThreadPoolExecutor
from time import sleep
def wait_on_future():
sleep(1)
print(f.done()) # f is not done obviously
f2 = executor.submit(pow, 5, 2)
print(f2.result())
sleep(1)
executor
Change by gaoxinge :
--
components: Library (Lib)
nosy: gaoxinge
priority: normal
pull_requests: 18575
severity: normal
status: open
title: modify code format of json library for pep7,8
type: enhancement
versions: Python 3.9
___
Python tracker
gaoxinge added the comment:
Your point makes sense. We should still also consider the `int`, `Decimal`,
`Fraction`, `math.nan`, `math.inf`, `np.int` and so on. So
- `geometric mean`: input should be positive (>= 0)
- `harmonic mean`: input should be nonzero (!= 0)
- `mean` or `fm
gaoxinge added the comment:
The document
https://github.com/WarrenWeckesser/cpython/blob/master/Lib/statistics.py#L389
in `harmonic_mean` is out-dated. I think we can simply follow the wiki:
- [arithemic mean](https://en.wikipedia.org/wiki/Arithmetic_mean)
- [geometric mean](https
gaoxinge added the comment:
I think that three kinds of mean should behave like:
- `geometric mean`: input should be float, finite and positive
- `harmonic mean`: input should be float, finite and nonzero
- `mean` or `fmean`: input should be float, finite
Otherwise these mean functions
New submission from gaoxinge :
## abstract
When using concurrent.futures.ThreadPoolExecutor module, if we code pool.submit
in callback, the callback may be not run. This is because main thread will
terminate, and call _python_exit to add none to _work_queue before subthread
run callback