On Thu, Apr 16, 2020 at 09:21:05PM -0700, Andrew Barnert via Python-ideas wrote:
> But I don’t see why that rules out the “bare colon” form that I and
> someone else apparently both proposed in separate sub threads of this
> thread:
>
> { :a, "b": x, :c }
>
> as shorthand for:
>
> { "
On 17/04/2020 04:04, Steven D'Aprano wrote:
I know what it means in function definitions, but somehow we seem to
have (accidentally?) flipped from talking about Rhodi's dislike of the
`*` in function *definitions* to an (imaginary? proposed?) use of `*` in
function *calls*.
Have I missed somethi
Andrew Barnert via Python-ideas writes:
> But I don’t see why that rules out the “bare colon” form that I and
> someone else apparently both proposed in separate sub threads of
> this thread:
>
> { :a, "b": x, :c }
This sort of reminds me of the "leading colon" convention for keywords
i
I agree that introducing a new way for creating implicit dict literals
only for the purpose of saving on keyword arguments seems too much of a
change. Although it would be an elegant solution as it builds on already
existing structures. And I don't think it hurts readability for function
calls, si
On Fri, Apr 17, 2020 at 5:08 AM Steven D'Aprano wrote:
> On Thu, Apr 16, 2020 at 07:50:30PM +0200, Alex Hall wrote:
> > >
> > > And what would you do if you wanted to call:
> > >
> > > self.do_something(positional, keyword=keyword, keyword1=somethingelse,
> > > keyword2=keyword2)
> > >
> > > ?
>
On Fri, Apr 17, 2020 at 03:46:31AM -, oliveira.rodrig...@gmail.com wrote:
> @Steven D'Aprano see that it doesn't actually have to look like a
> pair, it doesn't need to be one at all. Just like in:
> ```python
> def f(a):
> ...
> f(x)
> ```
>
> `x` is implicitly assigned with `a`
We're
On Fri, Apr 17, 2020 at 11:25:15AM +0200, Alex Hall wrote:
> I don't think you really need to know what it means to read the code for
> most purposes.
*blink*
> You look at the function call and you can see a bunch of
> names being passed to self.do_something. If the function call has
> 'keyword
> open('example.txt', encoding, newline, errors, mode)
>
> open('example.txt', *, encoding, newline, errors, mode)
>
> Would you agree that the two of those have *radically* different
> meanings? The first will, if you are lucky, fail immediately; the second
> may succeed. But to the poor u
On Fri, Apr 17, 2020 at 11:57 AM Steven D'Aprano
wrote:
> On Fri, Apr 17, 2020 at 11:25:15AM +0200, Alex Hall wrote:
>
> > I don't think you really need to know what it means to read the code for
> > most purposes.
>
> *blink*
>
> > You look at the function call and you can see a bunch of
> > nam
>
> But this means the reader could miss the star, especially with a very
> large function call over multiple lines, and if that reader happens to use
> that particular function A LOT and know the parameter order without having
> to look they would pretty easily believe the arguments are doing some
>
>> This holds even more strongly if the various parameters take the same
>> type:
>>
>> # a real signature from one of my functions
>> def function(
>>meta:bool,
>>dunder:bool,
>>private:bool,
>>ignorecase:bool,
>>invert:bool)
>>
On 17/04/2020 11:37, Alex Hall wrote:
On Fri, Apr 17, 2020 at 11:57 AM Steven D'Aprano
wrote:
On Fri, Apr 17, 2020 at 11:25:15AM +0200, Alex Hall wrote:
You look at the function call and you can see a bunch of
names being passed to self.do_something. If the function call has
'keyword=keyword
On 17.04.20 12:49, Alex Hall wrote:
But this means the reader could miss the star, especially with a
very large function call over multiple lines, and if that reader
happens to use that particular function A LOT and know the
parameter order without having to look they would pret
Here's another idea for the bikeshed:
f(spam, pass eggs, ham)
equivalent to
f(spam, eggs=eggs, ham=ham)
--
Greg
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.
On Fri, Apr 17, 2020 at 8:52 PM Alex Hall wrote:
>>
>> But this means the reader could miss the star, especially with a very large
>> function call over multiple lines, and if that reader happens to use that
>> particular function A LOT and know the parameter order without having to
>> look the
On 4/17/2020 9:28 AM, Chris Angelico wrote:
On Fri, Apr 17, 2020 at 8:52 PM Alex Hall wrote:
But this means the reader could miss the star, especially with a very large
function call over multiple lines, and if that reader happens to use that
particular function A LOT and know the parameter o
> What's the advantage of a mode switch? This seems perfectly clear to
> > me without any sort of magical cutoff.
>
> I agree with Chris. I'm not a fan of the original proposal with the "="
> (because I don't think this is a problem that needs solving), but at
> least it made more sense than a mode
>
> > What's the advantage of a mode switch? This seems perfectly clear to
>> > me without any sort of magical cutoff.
>>
>> I agree with Chris. I'm not a fan of the original proposal with the "="
>> (because I don't think this is a problem that needs solving), but at
>> least it made more sense th
On Sat, Apr 18, 2020 at 12:22:36AM +1200, Greg Ewing wrote:
> Here's another idea for the bikeshed:
>
>f(spam, pass eggs, ham)
How is "pass" meaningful here? To me this looks like a choice of a
random keyword:
f(spam, import eggs, ham)
I don't see the link between a keyword that mean
@ChrisAngelico I do prefer the original proposal, though I do see the point of
it being harder for beginner to understand.
The mode-switch proposal though would not impede one to mix shorthand and
longhand forms. This should be valid syntax:
```python
return render_template("index.html", *,
On Fri, Apr 17, 2020 at 11:57 PM wrote:
>
> @ChrisAngelico I do prefer the original proposal, though I do see the point
> of it being harder for beginner to understand.
>
> The mode-switch proposal though would not impede one to mix shorthand and
> longhand forms. This should be valid syntax:
>
On Fri, Apr 17, 2020 at 11:59 PM Steven D'Aprano wrote:
>
> On Sat, Apr 18, 2020 at 12:22:36AM +1200, Greg Ewing wrote:
> > Here's another idea for the bikeshed:
> >
> >f(spam, pass eggs, ham)
>
>
> How is "pass" meaningful here? To me this looks like a choice of a
> random keyword:
>
> f(
On Sat, Apr 18, 2020 at 12:01:55AM +1000, Chris Angelico wrote:
> Oh but Steven, Steven, Steven, how can you pass up an opportunity to
> reignite the fires of "pass by value" and "pass by reference"? This is
> CLEARLY the way to represent pass-by-reference where the reference is
> to a mythical va
Hmmm... I disagree with Chris.
I'm definitely -1 on a magic dangling 'foo=' after variable names. And
something less than -1 on the even more magic "Lisp symbol that isn't a
symbol" ':foo'.
Those are just ugly and mysterious.
However, I don't HATE the "mode switch" use of '*' or '**' in function
On Fri, Apr 17, 2020 at 9:57 AM wrote:
> The mode-switch proposal though would not impede one to mix shorthand and
> longhand forms. This should be valid syntax:
>
> ```python
> return render_template("index.html", *,
> twitter, username=user["display_name"],
> channel, channelid, error,
On Sat, Apr 18, 2020 at 1:35 AM Steven D'Aprano wrote:
>
> On Sat, Apr 18, 2020 at 12:01:55AM +1000, Chris Angelico wrote:
>
> > Oh but Steven, Steven, Steven, how can you pass up an opportunity to
> > reignite the fires of "pass by value" and "pass by reference"? This is
> > CLEARLY the way to re
On 4/17/2020 12:28 PM, Chris Angelico wrote:
On Sat, Apr 18, 2020 at 1:54 AM David Mertz wrote:
Hmmm... I disagree with Chris.
I'm definitely -1 on a magic dangling 'foo=' after variable names. And something less
than -1 on the even more magic "Lisp symbol that isn't a symbol" ':foo'.
Those
On Sat, Apr 18, 2020 at 2:41 AM Eric V. Smith wrote:
>
> On 4/17/2020 12:28 PM, Chris Angelico wrote:
> > On Sat, Apr 18, 2020 at 1:54 AM David Mertz wrote:
> >> Hmmm... I disagree with Chris.
> >>
> >> I'm definitely -1 on a magic dangling 'foo=' after variable names. And
> >> something less th
On Apr 16, 2020, at 21:42, oliveira.rodrig...@gmail.com wrote:
>
> I believe this is a different feature, non-exclusive to the one proposed
> here, that would also make it possible not to re-declare keywords.
Yes, it is a different feature from magic call syntax. And yes, theoretically
they’re
On Fri, Apr 17, 2020 at 6:09 PM David Mertz wrote:
> On Fri, Apr 17, 2020 at 9:57 AM wrote:
>
>> The mode-switch proposal though would not impede one to mix shorthand and
>> longhand forms. This should be valid syntax:
>>
>> ```python
>> return render_template("index.html", *,
>> twitter, us
Perhaps an easier next step would be to get better data about people's
opinions with a simple poll? Is there a standard way to vote on things in
this list?
I say we do a simple approval vote. Everyone ticks all the syntaxes that
they think would be acceptable to include in the language. It's not v
> On Apr 17, 2020, at 01:58, Steven D'Aprano wrote:
>
> On Thu, Apr 16, 2020 at 09:21:05PM -0700, Andrew Barnert via Python-ideas
> wrote:
>
>> But I don’t see why that rules out the “bare colon” form that I and
>> someone else apparently both proposed in separate sub threads of this
>> thread
On Fri, Apr 17, 2020 at 2:22 PM Andrew Barnert via Python-ideas <
python-ideas@python.org> wrote:
> What examples can you think of—in English, Python, other popular
> languages, math notation, whatever—where there’s an infix-operator-like
> thing and the right token is elided and inferred implicit
On Fri, 17 Apr 2020, Alex Hall wrote:
Perhaps an easier next step would be to get better data about people's opinions
with a simple poll? Is there a standard way to vote on things in this
but it's easy and may inform what to do next.
For what it's worth, I'm a strong -1 on this whole thing, r
On Sat, Apr 18, 2020 at 4:41 AM Paul Svensson wrote:
>
> On Fri, 17 Apr 2020, Alex Hall wrote:
>
> >Perhaps an easier next step would be to get better data about people's
> >opinions with a simple poll? Is there a standard way to vote on things in
> >this
> >but it's easy and may inform what to
On Apr 17, 2020, at 11:30, David Mertz wrote:
>
> I can't think of any either...
You know, an ellipsis is about the farthest thing from an *unmarked* elision
that you can get [without brackets and reinsertion of a more verbose version of
the thing you wanted to elide -ed].
But the hyphen exam
On Thu, 2020-04-16 at 21:21 -0700, Andrew Barnert via Python-ideas
wrote:
> On Apr 16, 2020, at 20:48, oliveira.rodrig...@gmail.com wrote:
> > In Javascript ES6 they don't have sets built like python so `{}`
> > always refers to objects being constructed. It does indeed support
> > implicit key: va
On Fri, Apr 17, 2020 at 10:29 AM Alex Hall wrote:
> Perhaps an easier next step would be to get better data about people's
> opinions with a simple poll? Is there a standard way to vote on things in
> this list?
>
No, but if you want to create a poll I would strongly advise that you
create a pol
On 17/04/2020 19:21, Andrew Barnert via Python-ideas wrote:
On Apr 17, 2020, at 01:58, Steven D'Aprano wrote:
On Thu, Apr 16, 2020 at 09:21:05PM -0700, Andrew Barnert via Python-ideas
wrote:
But I don’t see why that rules out the “bare colon” form that I and
someone else apparently both pro
I'm kinda leaning -0.5 even on the form that I think is least bad (the mode
switch approach).
If typing the same variable from the caller to use in the parameter is
really too much repetition, you could maybe just do this:
>>> render_template("index.html",
... username="display_name",
...
Here's a script to find places where this proposal could be useful. Try it
on a directory.
```python
import ast
import linecache
import sys
from pathlib import Path
root = Path(sys.argv[1])
def main():
for path in root.rglob("**/*.py"):
source = path.read_text()
try:
On 4/17/20 3:04 PM, Andrew Barnert wrote:
> I can't think of any either...
> You know, an ellipsis is about the farthest thing from an *unmarked*
> elision that you can get [without brackets and reinsertion of a more
> verbose version of the thing you wanted to elide -ed].
Anyone who has read Celi
@ChrisAngelico @EricVSmith Thank you for be willing to sponsor the PEP. I think
it may be best to start writing it already, as I see it, the proposal wasn't a
clear no (nor a clear yes but if it was to be, probably someone else would
already have proposed something in these lines and we wouldn't
@AndrewBarnert yes I should have thought it better that there is no need to use
`kwargs` forcibly. My bad. I am a little more convinced of this being a solid
candidate solution to the problem. Thanks for talking me through!
Rodrigo Martins de Oliveira
I also find the example with :keyword a bit jarring at first glance, so I
propose a double colon to alleviate the problem if we go in that direction.
Compare:
{ :a, "b": x, :c }
{ ::a, "b": x, ::c }
On Fri, Apr 17, 2020 at 10:05 PM Rhodri James wrote:
> On 17/04/2020 19:21, Andrew Barn
On Sat, Apr 18, 2020 at 6:30 AM wrote:
> I do wish to carry on with writing a PEP with your help guys. What's the next
> step?
Your primary reference is here:
https://www.python.org/dev/peps/pep-0001/#pep-workflow
Since you have a sponsor, the next step is to fork the PEPs repo on
GitHub and st
>
> If typing the same variable from the caller to use in the parameter is
> really too much repetition, you could maybe just do this:
>
> >>> render_template("index.html",
> ... username="display_name",
> ... setups="setups",
> ... **Q("x y z"))
> ('index.html',)
> {'username': 'displa
Thanks @ChrisAngelico! I will get to it. Once a first draft is ready I'll share
the github link in here.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailma
On Apr 17, 2020, at 13:07, David Mertz wrote:
>
>
> I'm kinda leaning -0.5 even on the form that I think is least bad (the mode
> switch approach).
>
> If typing the same variable from the caller to use in the parameter is really
> too much repetition, you could maybe just do this:
>
> >>>
On Apr 17, 2020, at 13:39, Alex Hall wrote:
>
>
> I also find the example with :keyword a bit jarring at first glance, so I
> propose a double colon to alleviate the problem if we go in that direction.
> Compare:
>
> { :a, "b": x, :c }
>
> { ::a, "b": x, ::c }
I can see the poi
On Apr 17, 2020, at 13:12, David Mertz wrote:
>
> However, proposals for symbols in Python *do* pop
> up from time to time, so this would perhaps make such a thing harder if
> it ever becomes desired (which is unlikely, but possible).
Sure. It would also conflict with Nick Coghlan’s version of
So, going back to the original post, dynamicdict is definitely something
I've reimplemented myself multiple times essentially exactly as your
pseudo-code in your C-command describes, just with the factory being
required to be not None (because I explicitly didn't want it to accept the
'no-factory'
On 18/04/20 1:28 am, Chris Angelico wrote:
What's the advantage of a mode switch?
I don't particularly like the mode switch either. Personally
I'd be happy with either
f(arg=)
or
f(=arg)
The latter is maybe more suggestive that "arg" is to be
evaluated in the local scope.
--
Greg
_
At the (online) language summit yesterday, our erstwhile BDFL responded to
a suggestion to use '?' in annotations. He said that many ideas arose over
time to us the question mark for various things, but he felt none so far
were compelling enough to exclude some future better use.
I actually find t
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,
setups=database.list_setups(channelid),
sched_tz, schedule, sched_tweet,
On 18/04/20 1:53 am, Steven D'Aprano wrote:
On Sat, Apr 18, 2020 at 12:22:36AM +1200, Greg Ewing wrote:
Here's another idea for the bikeshed:
f(spam, pass eggs, ham)
How is "pass" meaningful here?
It means "pass these things on as they are". Think
football pass, not quiz show pass.
--
On Fri, 17 Apr 2020 at 17:06, David Mertz wrote:
> I'm kinda leaning -0.5 even on the form that I think is least bad (the
> mode switch approach).
>
> If typing the same variable from the caller to use in the parameter is
> really too much repetition, you could maybe just do this:
>
>
For what ma
On 17.04.20 23:18, Andrew Barnert via Python-ideas wrote:
On Apr 17, 2020, at 13:39, Alex Hall wrote:
I also find the example with :keyword a bit jarring at first glance,
so I propose a double colon to alleviate the problem if we go in
that direction. Compare:
{ :a, "b": x, :c }
{ ::a
On 17.04.20 10:53, Steven D'Aprano wrote:
I think that, as little as I like the original proposal and am not
really convinced it is necessary, I think that it is better to have the
explicit token (the key/parameter name) on the left, and the implicit
token (blank) on the right:
key=
I sus
On 2020-04-18 01:32, Dominik Vilsmeier wrote:
On 17.04.20 10:53, Steven D'Aprano wrote:
I think that, as little as I like the original proposal and am not
really convinced it is necessary, I think that it is better to have the
explicit token (the key/parameter name) on the left, and the implici
I think you should hold off a little bit until there is a bit more
consensus on syntax. Or at least delay the parts that are specific to
syntax.
I think it would help your case if you avoided toy examples like the one
you started with:
foo(baz=baz, qux=qux)
and concentrated on real exampl
The rush to push this to a PEP is unseemly. This has only been two
days and I am sure that there will be many people who could be
interested but haven't had a chance to look at the thread yet due to
other committments.
(Even in this time of Covid-19 lockdowns, some people have work and
other c
On Sat, Apr 18, 2020 at 1:04 PM Steven D'Aprano wrote:
>
> The rush to push this to a PEP is unseemly. This has only been two
> days and I am sure that there will be many people who could be
> interested but haven't had a chance to look at the thread yet due to
> other committments.
>
All the mor
On Fri, Apr 17, 2020 at 08:12:26PM -0300, Joao S. O. Bueno wrote:
> For what matters, when I stopped to think about this, I came out with this
> exactly design!
>
> Maybe this is a 'one obvious way' to deal with it, without changing any
> syntax?
There's nothing "obvious" about using a private i
On Sat, Apr 18, 2020 at 01:09:32PM +1000, Chris Angelico wrote:
> On Sat, Apr 18, 2020 at 1:04 PM Steven D'Aprano wrote:
> >
> > The rush to push this to a PEP is unseemly. This has only been two
> > days and I am sure that there will be many people who could be
> > interested but haven't had a ch
On Sat, Apr 18, 2020 at 10:23:59AM +1200, Greg Ewing wrote:
> On 18/04/20 1:53 am, Steven D'Aprano wrote:
> >On Sat, Apr 18, 2020 at 12:22:36AM +1200, Greg Ewing wrote:
> >>Here's another idea for the bikeshed:
> >>
> >>f(spam, pass eggs, ham)
> >
> >
> >How is "pass" meaningful here?
>
> It m
On Fri, Apr 17, 2020 at 03:33:56PM -0400, David Mertz wrote:
> I think I'm the first person to mention Lisp symbols. Maybe not
> though.
I know it's not a competition, but I think Stephen Turnbull beat you by
five hours :-)
(At least if I can do timezone calculations correctly.)
--
Steven
I gladly honor Stephen T, who understands many things, including timezones
better than I do.
On Sat, Apr 18, 2020, 12:35 AM Steven D'Aprano wrote:
> On Fri, Apr 17, 2020 at 03:33:56PM -0400, David Mertz wrote:
>
> > I think I'm the first person to mention Lisp symbols. Maybe not
> > though.
>
>
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
-
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, r
70 matches
Mail list logo