[Python-ideas] Recursive submit in concurrent.future.ProcessPoolExecutor

2021-11-18 Thread Evan Greenup via Python-ideas
Hi, Currrently, is it allowed for process worker to submit new task to its parent executor? Considering the following Python script: ```python3 import concurrent.futures with concurrent.futures.ProcessPoolExecutor(max_workers=12) as ppe: def hello(n: int) -> int: if n == 0:

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Paul Bryan
I too have used plain strings in Annotated[...] to document fields in dataclasses. On Thu, 2021-11-18 at 13:51 -0500, Ricky Teachey wrote: > On Thu, Nov 18, 2021 at 1:39 PM Thomas Grainger > wrote: > > Ricky Teachey wrote: > > > Could this be a use case for typing.Annotated? > > > In [6]: from

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Ricky Teachey
On Thu, Nov 18, 2021 at 1:39 PM Thomas Grainger wrote: > Ricky Teachey wrote: > > Could this be a use case for typing.Annotated? > > In [6]: from dataclasses import dataclass > > In [7]: from typing import Annotated > > In [8]: class A: > >...: """Docstring for class A.""" > >...:

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Thomas Grainger
Ricky Teachey wrote: > Could this be a use case for typing.Annotated? > In [6]: from dataclasses import dataclass > In [7]: from typing import Annotated > In [8]: class A: >...: """Docstring for class A.""" >...: x: Annotated[int, "Docstring for x"] >...: y: Annotated[bool,

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Marc-Andre Lemburg
On 17.11.2021 15:26, tmkehrenb...@gmail.com wrote: > Hi all, > > I have seen discussion of docstrings for class attributes before on this > list, but not with this exact proposal. > > My motivation is that I have a dataclass for which I want to write > docstrings that can be accessed at runtime.

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Guido van Rossum
+1 On Thu, Nov 18, 2021 at 09:31 Michael Foord wrote: > > > On Thu, 18 Nov 2021 at 04:38, Steven D'Aprano wrote: > >> On Wed, Nov 17, 2021 at 02:26:16PM -, tmkehrenb...@gmail.com wrote: >> >> > @dataclass >> > class A: >> > """Docstring for class A.""" >> > x: int >> >

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Michael Foord
On Thu, 18 Nov 2021 at 04:38, Steven D'Aprano wrote: > On Wed, Nov 17, 2021 at 02:26:16PM -, tmkehrenb...@gmail.com wrote: > > > @dataclass > > class A: > > """Docstring for class A.""" > > x: int > > """Docstring for x""" > > y: bool = True > > "Docstring for y" > > > >

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread tmkehrenberg
I've seen this proposed before, but it is, as you said, a bit arduous. For dataclasses specifically, there is also another possibility: add a `doc` argument to dataclasses.field. Like this: from dataclasses import dataclass, field @dataclass class A: x: int = field(doc="Docstring for x.")

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Ricky Teachey
On Thu, Nov 18, 2021 at 10:28 AM Ricky Teachey wrote: > Could this be a use case for typing.Annotated? > > ... > > The syntax is a bit arduous; I'd be in favor of thinking through ways to > make it easier to write. But the basic functionality already exists; > there's no reason to duplicate it

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Ricky Teachey
Could this be a use case for typing.Annotated? In [6]: from dataclasses import dataclass In [7]: from typing import Annotated In [8]: class A: ...: """Docstring for class A.""" ...: x: Annotated[int, "Docstring for x"] ...: y: Annotated[bool, "Docstring for y"] = True In

[Python-ideas] Python Developer’s Guide chinese version

2021-11-18 Thread zhouwenbonwpu
hi all, I want to know does Python Developer’s Guide have chinese version, If not, i want to do some translation, may i tell to PSF(or other people) to grant authorization? May you also want to do this translation, please contact me. Best, bobozi ___

[Python-ideas] Re: Adding pep8-casing-compliant aliases for the entire stdlib

2021-11-18 Thread tmkehrenberg
Neil Girdhar wrote: > The proposal to change list and str is way too ambitious. Maybe the uppercase versions of dict, list and tuple in the typing module could be turned into direct aliases of the built-in types? With Python 3.9, there is no real distinction anyway between builtins.list and

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread tmkehrenberg
Stephen J. Turnbull wrote: > @standard_class_docstring_parser > class A: > """ > Class docstring. > x: Docstring for x > y: Docstring for y > """ > x: int > y: bool = True Oh, this is actually a nice idea. You could have a decorator

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Chris Angelico
On Thu, Nov 18, 2021 at 7:44 PM Stephen J. Turnbull wrote: > > Steven D'Aprano writes: > > On Wed, Nov 17, 2021 at 02:26:16PM -, tmkehrenb...@gmail.com wrote: > > > > > @dataclass > > > class A: > > > """Docstring for class A.""" > > > x: int > > > """Docstring for x""" >

[Python-ideas] Re: Runtime-accessible attribute docstrings

2021-11-18 Thread Stephen J. Turnbull
Steven D'Aprano writes: > On Wed, Nov 17, 2021 at 02:26:16PM -, tmkehrenb...@gmail.com wrote: > > > @dataclass > > class A: > > """Docstring for class A.""" > > x: int > > """Docstring for x""" > > y: bool = True > > "Docstring for y" > However a real problem is