On Sun, Apr 19, 2020 at 3:48 PM Stephen J. Turnbull
wrote:
> I'm arguing that multiple changes in Python, and additional experience
> for me, mean that I run into same name arguments much less frequently
> nowadays than I once did, frameworks like Flask notwithstanding.
> There are several
Chris Angelico writes:
> Except that render_template isn't one of my own functions. It's part
> of the templating engine (this is a Flask web app). There is no
> refactoring to do - that IS the correct way to call it.
So NOW you tell me! ;-) Just kidding: of course I recognized that as a
On 19/04/20 7:17 am, Alex Hall wrote:
there
is something about all these examples (plausibility?) that feels
distinctly different from your proposal.
To me it seems like an unnecessarily complicated syntax that goes
out of its way to look deceptively like something else.
f(a, b, c)
On Apr 18, 2020, at 05:16, Alex Hall wrote:
>
> Is there anything else similar in the language? Obviously there are cases
> where the same text has different meanings in different contexts, but I don't
> think you can ever refactor an expression (or text that looks like an
> expression) into
On Sat, Apr 18, 2020 at 5:03 PM Steven D'Aprano wrote:
> On Sat, Apr 18, 2020 at 02:13:51PM +0200, Alex Hall wrote:
>
> > My issue with this, and maybe it's what Andrew is also trying to say, is
> > that it breaks our usual assumptions about composing expressions. `{u,
> v}`
> > is an
On 18.04.20 08:14, Steven D'Aprano wrote:
This proposal is an alternative to Rodrigo's "Keyword arguments
self-assignment" thread.
Rodrigo, please feel free to mine this for useful nuggets in your PEP.
(I don't claim to have invented the syntax -- I think it might have been
Alex Hall?)
> f(**{u, v})
> I think a fundamental point is that `**{identifier}` looks like
> you are applying `**` unpacking to a set, but you actually aren't, it is
> a special syntactic form. If that disturbs you, I'm not going to say you
> are wrong.
>
The special syntactic form doesn't bother me that
On Sat, Apr 18, 2020 at 12:19:30PM -0400, David Mertz wrote:
> On Sat, Apr 18, 2020, 8:15 AM Alex Hall wrote:
>
> > Under your proposal, these two programs are both valid syntax with
> > different meanings:
> >
> > (1)
> >
> f(**{u, v})
> >
> > (2)
> >
> x = {u, v}
> > f(**x)
> >
>
> I don't
On Sat, Apr 18, 2020, 8:15 AM Alex Hall wrote:
> Under your proposal, these two programs are both valid syntax with
> different meanings:
>
> (1)
>
f(**{u, v})
>
> (2)
>
x = {u, v}
> f(**x)
>
I don't understand what the meaning of (2) would be. Currently it is a
TypeError... Is that "valid"
> On 15 Apr 2020, at 19:56, Ander Juaristi wrote:
>
> Hi list,
>
> I haven't seen this being discussed, but TL;DR I just want to propose to
> extend the ssl module so that TLS session state can be serialized to disk.
You might want to read this analysis of TLS session tickets in TLS 1.2.
On Sun, Apr 19, 2020 at 1:04 AM Steven D'Aprano wrote:
> And one final example:
>
> class C:
> def method(self):
> pass
>
> versus:
>
> def method(self):
> pass
>
> class C:
> method
>
Indeed. However, if you put "method = method", it would
On Sat, Apr 18, 2020 at 02:13:51PM +0200, Alex Hall wrote:
> My issue with this, and maybe it's what Andrew is also trying to say, is
> that it breaks our usual assumptions about composing expressions. `{u, v}`
> is an expression, it represents a set, and it always represents that
> wherever you
On Sat, Apr 18, 2020 at 11:19 PM Stephen J. Turnbull
wrote:
>
> Chris Angelico writes:
>
> > Look at the real-world examples that I posted and tell me what I
> > should be doing differently, if it's an anti-pattern to be
> > discouraged.
>
> IIRC, you didn't post real-world examples relevant
Chris Angelico writes:
> Look at the real-world examples that I posted and tell me what I
> should be doing differently, if it's an anti-pattern to be
> discouraged.
IIRC, you didn't post real-world examples relevant to Paul's comment
because you posted only the call sites.
So, for example,
Ricky Teachey writes:
> A nice thing about the mode switch syntax could be that it makes
> [the convert prototype to call] routine faster (assuming there are
> no type hints!!!):
>
> f(*, a, b, c, g)
The trailing equals is faster (as long as you have defaults as in your
example), because
On Sat, Apr 18, 2020 at 8:18 AM Steven D'Aprano wrote:
> This proposal is an alternative to Rodrigo's "Keyword arguments
> self-assignment" thread.
>
> Rodrigo, please feel free to mine this for useful nuggets in your PEP.
>
> (I don't claim to have invented the syntax -- I think it might have
On Sat, Apr 18, 2020 at 12:42:10AM -0700, Andrew Barnert wrote:
> > Inside function calls, the syntax
> >
> > **{identifier [, ...]}
> >
> > expands to a set of `identifier=identifier` argument bindings.
> >
> > This will be legal anywhere inside a function call that keyword
> > unpacking
>
> And now Lisp bites me, because '::a' means ...
>
And a single colon also means something else in Lisp.
Does it matter much what that notation means in a different language?
Python will struggle to evolve if it can't conflict with other languages.
I myself am rarely annoyed by this issue,
On Fri, Apr 17, 2020 at 11:21:39AM -0700, Andrew Barnert wrote:
> > On Apr 17, 2020, at 01:58, Steven D'Aprano wrote:
[...]
> > After saving this draft, closing the email, then reopening it, I read
> > the proposed dict the same way. So I don't think it was just a momentary
> > glitch.
>
> I
Andrew Barnert via Python-ideas writes:
> On Apr 17, 2020, at 13:39, Alex Hall wrote:
> > { :a, "b": x, :c }
> >
> > { ::a, "b": x, ::c }
And now Lisp bites me, because '::a' means "the identifier 'a' in the
default namespace", which doesn't make sense in Python, because the
On Fri, Apr 17, 2020 at 11:39:41PM -0700, Andrew Barnert wrote:
> On Apr 17, 2020, at 21:01, Steven D'Aprano wrote:
> >
> > On Sat, Apr 18, 2020 at 10:23:59AM +1200, Greg Ewing wrote:
> >
> >> Think football pass, not quiz show pass.
> >
> > That analogy doesn't help me, especially since I
On Apr 17, 2020, at 23:18, Steven D'Aprano wrote:
>
>
> Keyword Unpacking Shortcut
> --
>
> Inside function calls, the syntax
>
> **{identifier [, ...]}
>
> expands to a set of `identifier=identifier` argument bindings.
>
> This will be legal anywhere inside a
On Sat, Apr 18, 2020 at 10:21:46AM +1200, Greg Ewing wrote:
> On 18/04/20 1:56 am, oliveira.rodrig...@gmail.com wrote:
> >This should be valid syntax:
> >
> >```python
> >return render_template("index.html", *,
> > twitter, username=user["display_name"],
> > channel, channelid, error,
> >
On Apr 17, 2020, at 21:01, Steven D'Aprano wrote:
>
> On Sat, Apr 18, 2020 at 10:23:59AM +1200, Greg Ewing wrote:
>
>> Think football pass, not quiz show pass.
>
> That analogy doesn't help me, especially since I don't know which game
> of football you are thinking of (soccer, rugby league,
This proposal is an alternative to Rodrigo's "Keyword arguments
self-assignment" thread.
Rodrigo, please feel free to mine this for useful nuggets in your PEP.
(I don't claim to have invented the syntax -- I think it might have been
Alex Hall?)
Keyword Unpacking Shortcut
25 matches
Mail list logo