Christopher Barker writes:
> This suggestion would mean that “=>” would create a deferred expression,
> but it would not be a general purpose one.
I would prefer that "=>" create a general purpose evaluation-deferred
expression, but that the general-purpose one be tuned such that you
don't need
Okay, here we go:
```
import typing
def extract_docstrings(K):
"""Extract docstrings from the class K's annotations.
Class attribute docstrings are extracted from the second item
in Annotated[...] attributes. The original annotation is left
unchanged.
FIXME:
Handling of
On Sun, Dec 12, 2021 at 12:38:06AM -0500, Ricky Teachey wrote:
> But Steve, since the most utilized documentation tool in the python
> universe, sphinx, doesn't look at Annotated
Yet.
> or in the lowercase-annotation part of an expression
Yet.
> for this and instead looks at a bare string belo
On Sun, Dec 12, 2021 at 5:02 PM Stephen J. Turnbull
wrote:
>
> Chris Angelico writes:
> > On Sat, Dec 11, 2021 at 8:07 PM Stephen J. Turnbull
> > wrote:
>
> > > This isn't about your proposal, it's about more general syntax. Not
> > > everything being discussed is about your proposal, and I
Chris Angelico writes:
> On Sat, Dec 11, 2021 at 8:07 PM Stephen J. Turnbull
> wrote:
> > This isn't about your proposal, it's about more general syntax. Not
> > everything being discussed is about your proposal, and I suspect one
> > reason you have trouble figuring out what other people a
On Sat, Dec 11, 2021, 10:58 PM Steven D'Aprano wrote:
> On Sat, Dec 11, 2021 at 05:02:39PM -0800, Christopher Barker wrote:
> > On Sat, Dec 11, 2021 at 3:03 PM Steven D'Aprano
> wrote:
>
> > > Didn't we decide there was an existing feature for this, no need for
> > > new syntax?
>
> > Well, no.
On Sat, 11 Dec 2021 at 16:30, Christopher Barker wrote:
>
> Sorry, accidentally off-list.
I did exactly the same a few days ago.
On Thu, 9 Dec 2021 at 07:49, Chris Angelico wrote:
>
> BTW, did you intend for this to be entirely off-list?
Nope, and apologies to all, but at least it's given me t
On 2021-12-12 at 17:28:23 +1300,
Greg Ewing wrote:
> On 11/12/21 1:22 pm, Christopher Barker wrote:
> > Darn — the P and A are swapped there.
>
> "Argument" and "actual" both start with "A" -- does that help?
Then Parameters must be Potential (before they become Actualized as
Arguments)?
__
On 11/12/21 5:40 pm, TobiasHT wrote:
> The right function to perform inlining on shall be determined at runtime and
cached in the same scope as where it’s performing it’s operations from cases where
the program performs large iterations or even in infinite loops and other cases
that need optim
On 11/12/21 1:22 pm, Christopher Barker wrote:
Darn — the P and A are swapped there.
"Argument" and "actual" both start with "A" -- does that help?
--
Greg
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to pytho
Chris Angelico writes:
> So [a "deferred object" is] a lambda function that gets called the
> moment you touch it in any way.
I'll take that as a question, though you present it like a fact. It's
a code object plus "other stuff" that gets called automatically when
dereferencing a name in most
On Sat, Dec 11, 2021 at 05:02:39PM -0800, Christopher Barker wrote:
> On Sat, Dec 11, 2021 at 3:03 PM Steven D'Aprano wrote:
> > Didn't we decide there was an existing feature for this, no need for
> > new syntax?
> Well, no. In fact, you could always put anything you wanted into an
> annotation
On Sun, Dec 12, 2021 at 1:23 PM Steven D'Aprano wrote:
>
> TL;DR: it is hard, but not impossible, to set function `__globals__`
> dunder to a ChainMap. Let's make it easier!
>
> Attempt 1: set __globals__ directly.
>
> >>> func.__globals__ = ns
> Traceback (most recent call last):
> File "", lin
TL;DR: it is hard, but not impossible, to set function `__globals__`
dunder to a ChainMap. Let's make it easier!
Background:
(1) Comprehensions skip class scope, leading to bug reports like these:
https://bugs.python.org/issue3692
https://bugs.python.org/issue26951
Note Guido's comment in the
On Sat, 2021-12-11 at 17:02 -0800, Christopher Barker wrote:
> It [Annotated] has a number of possible unspecified uses, but
> fundamentally, it's about the adding information to the type, not to
> the attribute -- e.g. not really intended for docstrings.
Ah, good point. I've conflated the two be
On Sat, Dec 11, 2021 at 3:03 PM Steven D'Aprano wrote:
> On Sat, Dec 11, 2021 at 10:07:50AM -0800, Christopher Barker wrote:
> > Where/how should class attribute doc strings be stored?
> >
> > Tacked on to the class __doc__ ?
> > Another dict?
> > __attr_doc__
> > Added to __annotaions__ ?
> > So
On Sat, Dec 11, 2021 at 10:49 AM Ricky Teachey wrote:
> The __annotations__ already exists. Is that a point in favor?
>
Yes and no. Right now, any object can be stored in annotations — having a
docstring tacked on would break who knows how much code.
However, there is the new inspect.get_annota
I think that because Sphinx could interpret strings below attributes
for documentation, that perhaps we should go in that direction in
Python proper.
Personally, I find this more readable:
class C:
x: Annotated[str, "Doc string"]
y: Annotated[int, "Doc string"]
over:
class C:
x:
On Sat, Dec 11, 2021 at 10:07:50AM -0800, Christopher Barker wrote:
> Where/how should class attribute doc strings be stored?
>
> Tacked on to the class __doc__ ?
> Another dict?
> __attr_doc__
> Added to __annotaions__ ?
> Something else?
Didn't we decide there was an existing feature for this,
On Sat, Dec 11, 2021, 1:19 PM Christopher Barker
wrote:
>
>
> Where/how should class attribute doc strings be stored?
>
> Tacked on to the class __doc__ ?
>
> Another dict?
>
> __attr_doc__
>
> Added to __annotaions__ ?
>
> Something else?
>
> If they are to be available at run time, they ne
On Sat, Dec 11, 2021, 12:57 AM Stephen J. Turnbull <
stephenjturnb...@gmail.com> wrote:
Simão Afonso writes:
> On 2021-12-10 12:20:44, Ricky Teachey wrote:
> > I meant to ask about a (global) module member, not the module docstring
> > itself. Like MY_GLOBAL below:
> >
> > """This is the mod
On Fri, Dec 10, 2021 at 9:57 PM Stephen J. Turnbull <
stephenjturnb...@gmail.com> wrote:
> To my mind Sphinx is sufficiently widely used
And the system used for the official Python docs.
that this settles the
> "above or below" question.
So yes :-)
However, what I haven’t seen in this thread
On 12/11/2021 12:11 PM, Chris Angelico wrote:
On Sun, Dec 12, 2021 at 4:06 AM Christopher Barker wrote:
Here’s a new (not well thought out) idea:
@dataclasses.dataclass
class A:
Input_list: list
length: int => len(input_list)
So length gets set to a “late bound default expression” t
On Sun, Dec 12, 2021 at 4:06 AM Christopher Barker wrote:
> Here’s a new (not well thought out) idea:
>
> @dataclasses.dataclass
> class A:
> Input_list: list
> length: int => len(input_list)
>
> So length gets set to a “late bound default expression” that Is an actual
> value. It would h
On Fri, Dec 10, 2021 at 7:54 PM Eric V. Smith wrote:
> Not sure if you meant this to go to the list or not.
>
I did — ( I know it seems to be the consensus, but I really think respond
to list should be the default…)
Moving on…
On 12/10/2021 7:50 PM, Christopher Barker wrote:
>
> Thanks Eric, th
The line of reasoning for the packaging tooling choosing TOML is elaborated
upon in PEP 518 (https://www.python.org/dev/peps/pep-0518/#other-file-formats)
and that choice was informed by a survey of the existing formats:
https://gist.github.com/njsmith/78f68204c5d969f8c8bc645ef77d4a8f.
_
And my response again, although slightly edited.
On 12/11/2021 11:28 AM, Christopher Barker wrote:
Sorry, accidentally off-list. Here it is again.
On Fri, Dec 10, 2021 at 4:50 PM Christopher Barker
wrote:
Thanks Eric, this is a great example, thanks.
It does raise some questions. T
Sorry, accidentally off-list. Here it is again.
On Fri, Dec 10, 2021 at 4:50 PM Christopher Barker
wrote:
> Thanks Eric, this is a great example, thanks.
>
> It does raise some questions. Though.
>
> If we could use any expression as a deferred expression, then we still
> have the two key questi
Yes!! This is something I've thought about proposing for a while, but I was
too lazy to do it. TOML is a wonderful language with an important place in
the Python ecosystem.
--
Finn (Mobile)
On Fri, Dec 10, 2021, 9:57 AM Sebastian Koslowski <
sebastian.koslow...@gmail.com> wrote:
> There is alre
On Sat, Dec 11, 2021 at 8:07 PM Stephen J. Turnbull
wrote:
>
> Chris Angelico writes:
> > On Sat, Dec 11, 2021 at 5:35 PM Stephen J. Turnbull
> > wrote:
>
> > > foo(x=>[a])
>
> > I'm not sure what that last line would mean.
>
> This isn't about your proposal, it's about more general synta
On Sat, Dec 11, 2021 at 8:07 PM Stephen J. Turnbull
wrote:
>
> Chris Angelico writes:
>
> > It's larger than argument defaults, but also smaller:
>
> Aside: I'm quite confused by your whole line of discussion here, but
> I'll let Eric follow up.
>
> > The overlap with late-bound defaults is the
Chris Angelico writes:
> On Sat, Dec 11, 2021 at 5:35 PM Stephen J. Turnbull
> wrote:
> > foo(x=>[a])
> I'm not sure what that last line would mean.
This isn't about your proposal, it's about more general syntax. Not
everything being discussed is about your proposal, and I suspect one
Chris Angelico writes:
> It's larger than argument defaults, but also smaller:
Aside: I'm quite confused by your whole line of discussion here, but
I'll let Eric follow up.
> The overlap with late-bound defaults is the simple case of mutable
> objects that you want to freshly construct every
33 matches
Mail list logo