On 22 July 2018 at 02:54, Steven D'Aprano wrote:
> I'll admit that the number and variety of new operators gives me some
> reason to pause, but for the simplest and most obvious case, the
> proposed ?? operator, I think that the fears about readability are
> grossly exaggerated.
Certainly *my* c
To get rid of the two other ( ?. And ?[] ), we could also define getitem and
getattr for None to always return None...;-)
I'm joking, although such an "absorbing" None may have been a good choice when
None was introduced, and maybe a way to do an absorbing-None per-statement
maybe nice...Nice e
On Sun, Jul 22, 2018 at 3:55 AM Steven D'Aprano wrote:
> Indeed we do. But we also say:
>
> - we say "+" instead of "add"
> - we say "//" instead of "floor division"
> - we say "**" instead of "exponentiation"
> - we say "&" instead of "bitwise AND"
> - we say "f( ... )" instead of "call f with a
On 22 July 2018 at 11:13, Giampaolo Rodola' wrote:
> - "a?[2] ?? 3" means "index 2 of list a is picked up if a is not None, else
> use 3"
Actually, doesn't it mean
if a is not None, pick up index 2 of the list.
If a is None, OR IF a[2] IS NONE, then use 3.
If a is None but a[2] is not None, use
On Sun, Jul 22, 2018 at 12:26 PM Paul Moore wrote:
> On 22 July 2018 at 11:13, Giampaolo Rodola' wrote:
> > - "a?[2] ?? 3" means "index 2 of list a is picked up if a is not None,
> else
> > use 3"
>
> Actually, doesn't it mean
>
> if a is not None, pick up index 2 of the list.
> If a is None, OR
Except that the third possibility is not possible...if a is None, a[2] will
throw an exception...
For now at least ;-)
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://pyt
Aargh, I hate Google Groups with a vengeance. If people *have* to post
from there, can they please change reply-to so that replies don't get
messed up. Or is that not possible, and yet another way that GG is
just broken?
Paul
-- Forwarded message --
From: Paul Moore
Date: 22 July
Hello,
I'm implementing a protocol where I need to read individual bytes until
a condition is met (value & 0x80 == 0).
My current approach is: value = (await reader.readexactly(1))[0]
To speed this up, I propose that a new function is added to
asyncio.StreamReader: value = await reader.readbyte(
On Sun, Jul 22, 2018 at 12:13:04PM +0200, Giampaolo Rodola' wrote:
> On Sun, Jul 22, 2018 at 3:55 AM Steven D'Aprano wrote:
[...]
> > I don't think that "+" is harder to read than
> > "standard_mathematics_operators_numeric_addition"
>
>
> Please let's drop the argument that + - * / = and ? are
On Sun, Jul 22, 2018 at 10:10 PM, Steven D'Aprano wrote:
> As a community, we're risk-adverse. I understand why we should be
> conservative in what we add to the language (once added, it cannot
> easily be removed if it turns out to be a mistake) but on Python-Ideas
> we regularly demand levels of
On Sun, Jul 22, 2018, 8:11 AM Steven D'Aprano wrote:
> On Sun, Jul 22, 2018 at 12:13:04PM +0200, Giampaolo Rodola' wrote:
> > Please let's drop the argument that + - * / = and ? are the same.
> We shouldn't judge proposals on how mysterious they are the first time we
> see them, because everythin
The ?? operator is probably the less scary one regarding legibility, and in
guessing (or remembering) what it exactly does...
Well, at least I think I understand what it does exactly, but if I'm not wrong
there, what it does is also quite simple and minimal.
A function returning it's first non-N
On Sun, Jul 22, 2018 at 11:22 PM, Grégory Lielens
wrote:
> The ?? operator is probably the less scary one regarding legibility, and in
> guessing (or remembering) what it exactly does...
> Well, at least I think I understand what it does exactly, but if I'm not
> wrong there, what it does is als
On Sun, Jul 22, 2018 at 2:10 PM Steven D'Aprano wrote:
>
> On Sun, Jul 22, 2018 at 12:13:04PM +0200, Giampaolo Rodola' wrote:
> > On Sun, Jul 22, 2018 at 3:55 AM Steven D'Aprano wrote:
> [...]
> > > I don't think that "+" is harder to read than
> > > "standard_mathematics_operators_numeric_additi
On Sun, Jul 22, 2018 at 11:35 PM, Giampaolo Rodola' wrote:
> On Sun, Jul 22, 2018 at 2:10 PM Steven D'Aprano wrote:
>>
>> On Sun, Jul 22, 2018 at 12:13:04PM +0200, Giampaolo Rodola' wrote:
>> > On Sun, Jul 22, 2018 at 3:55 AM Steven D'Aprano
>> > wrote:
>> [...]
>> > > I don't think that "+" is
Short circuit if the first argument is NOT None, I guess? ;-)
Yes, so a short circuit is sometimes good. Not often imho, for a default
triggered by None, but sometimes...
In the case it is, do you want it to be hidden in an expression? Usually it
would be better to draw attention, when the defau
Steven D'Aprano writes:
> In my opinion, writing
>
> expression if expression is None else default
>
> is the *opposite* of Pythonic, it is verbose and the DRY violation is
> inelegant (as well as inefficient). I'd much rather use:
>
> expression ?? default
Sure, if "expressio
On Sun, Jul 22, 2018 at 3:38 PM Chris Angelico wrote:
>
> On Sun, Jul 22, 2018 at 11:35 PM, Giampaolo Rodola'
> wrote:
> > On Sun, Jul 22, 2018 at 2:10 PM Steven D'Aprano wrote:
> >>
> >> On Sun, Jul 22, 2018 at 12:13:04PM +0200, Giampaolo Rodola' wrote:
> >> > On Sun, Jul 22, 2018 at 3:55 AM S
On 2018-07-22 09:01:58 -0400, David Mertz wrote:
> On Sun, Jul 22, 2018, 8:11 AM Steven D'Aprano wrote:
> To me, the ?? operator seems like a clear and obvious win. The other
> variants are more complex and the benefit is not as obvious to me, so I
> haven't decided where I stand on th
On Sat, Jul 21, 2018, 6:55 PM Steven D'Aprano wrote:
> On Sun, Jul 22, 2018 at 01:56:35AM +0200, Giampaolo Rodola' wrote:
> > On Thu, Jul 19, 2018 at 3:39 PM Steven D'Aprano
> wrote:
> > > Tens of thousands of non-English speakers have had to learn the meaning
> > > of what might as well be mean
For basic slices, the normal "slice(start, stop, step)" syntax works well.
But it becomes much more verbose to create more complicated slices that you
want to re-use for multiple multidimensional data structures, like numpy,
pandas, xarray, etc.
One idea I had was to allow creating slices by using
Todd schrieb am 22.07.2018 um 21:03:
> For basic slices, the normal "slice(start, stop, step)" syntax works well.
> But it becomes much more verbose to create more complicated slices that you
> want to re-use for multiple multidimensional data structures, like numpy,
> pandas, xarray, etc.
>
> One
22.07.18 22:03, Todd пише:
For basic slices, the normal "slice(start, stop, step)" syntax works
well. But it becomes much more verbose to create more complicated
slices that you want to re-use for multiple multidimensional data
structures, like numpy, pandas, xarray, etc.
One idea I had was
On 2018-07-22 08:10, Steven D'Aprano wrote:
> Indeed. And I think we ought to think carefully about the benefits and
> costs of all of those variants separately.
>
> To me, the ?? operator seems like a clear and obvious win. The other
> variants are more complex and the benefit is not as obvious
On Mon, Jul 23, 2018 at 1:09 AM, Giampaolo Rodola' wrote:
> On Sun, Jul 22, 2018 at 3:38 PM Chris Angelico wrote:
>>
>> On Sun, Jul 22, 2018 at 11:35 PM, Giampaolo Rodola'
>> wrote:
>> > On Sun, Jul 22, 2018 at 2:10 PM Steven D'Aprano
>> > wrote:
>> >>
>> >> On Sun, Jul 22, 2018 at 12:13:04PM
On Sun, Jul 22, 2018 at 10:01 PM Chris Angelico wrote:
>
> On Mon, Jul 23, 2018 at 1:09 AM, Giampaolo Rodola' wrote:
> > On Sun, Jul 22, 2018 at 3:38 PM Chris Angelico wrote:
> > I find it less explicit mainly because it does 3 things at once: check
> > if attribute is None, use it if it's not N
On Sun, 22 Jul 2018 22:43:15 +0200
"Giampaolo Rodola'"
wrote:
> On Sun, Jul 22, 2018 at 10:01 PM Chris Angelico wrote:
> >
> > On Mon, Jul 23, 2018 at 1:09 AM, Giampaolo Rodola'
> > wrote:
> > > On Sun, Jul 22, 2018 at 3:38 PM Chris Angelico wrote:
> > > I find it less explicit mainly becau
On Mon, Jul 23, 2018 at 6:43 AM, Giampaolo Rodola' wrote:
> On Sun, Jul 22, 2018 at 10:01 PM Chris Angelico wrote:
>>
>> On Mon, Jul 23, 2018 at 1:09 AM, Giampaolo Rodola'
>> wrote:
>> > On Sun, Jul 22, 2018 at 3:38 PM Chris Angelico wrote:
>> > I find it less explicit mainly because it does 3
On 2018-07-22 10:33:23 -0700, Michael Selik wrote:
> On Sat, Jul 21, 2018, 6:55 PM Steven D'Aprano wrote:
> On Sun, Jul 22, 2018 at 01:56:35AM +0200, Giampaolo Rodola' wrote:
> > On Thu, Jul 19, 2018 at 3:39 PM Steven D'Aprano
> > wrote:
> > > Tens of thousands of non-English spea
On Mon, 23 Jul 2018 06:53:53 +1000
Chris Angelico wrote:
>
> >> Which is back to what Steven said: people demand such a high
> >> bar for new syntax that few existing pieces of syntax would pass it.
> >
> > Probably. That's what happens when a language is mature. Personally I
> > don't think th
On Sun, Jul 22, 2018, 4:56 PM Chris Angelico wrote:
> It means people place crazily high demands on new proposals.
>
I think the bar has been much too low for introducing new features over the
last 5 years or so. Internal changes like the new dictionary implementation
are fine, but user-facing c
On Sun, Jul 22, 2018 at 11:51 PM Giampaolo Rodola' wrote:
>
> On Sun, Jul 22, 2018 at 10:55 PM Chris Angelico wrote:
> >
> > On Mon, Jul 23, 2018 at 6:43 AM, Giampaolo Rodola'
> > wrote:
> > > On Sun, Jul 22, 2018 at 10:01 PM Chris Angelico wrote:
> > >>
> > >> On Mon, Jul 23, 2018 at 1:09 AM,
On Sun, Jul 22, 2018 at 10:55 PM Chris Angelico wrote:
>
> On Mon, Jul 23, 2018 at 6:43 AM, Giampaolo Rodola' wrote:
> > On Sun, Jul 22, 2018 at 10:01 PM Chris Angelico wrote:
> >>
> >> On Mon, Jul 23, 2018 at 1:09 AM, Giampaolo Rodola'
> >> wrote:
> >> > On Sun, Jul 22, 2018 at 3:38 PM Chris
On Mon, Jul 23, 2018 at 7:51 AM, Giampaolo Rodola' wrote:
> On Sun, Jul 22, 2018 at 10:55 PM Chris Angelico wrote:
>>
>> On Mon, Jul 23, 2018 at 6:43 AM, Giampaolo Rodola'
>> wrote:
>> > On Sun, Jul 22, 2018 at 10:01 PM Chris Angelico wrote:
>> >>
>> >> On Mon, Jul 23, 2018 at 1:09 AM, Giampao
On Mon, Jul 23, 2018 at 12:08 AM Chris Angelico wrote:
>
> On Mon, Jul 23, 2018 at 7:51 AM, Giampaolo Rodola' wrote:
> > On Sun, Jul 22, 2018 at 10:55 PM Chris Angelico wrote:
> >>
> >> On Mon, Jul 23, 2018 at 6:43 AM, Giampaolo Rodola'
> >> wrote:
> >> > On Sun, Jul 22, 2018 at 10:01 PM Chris
On Sun, Jul 22, 2018 at 11:26:15PM +1000, Chris Angelico wrote:
> You forget that the operator will *short-circuit*. It will not
> evaluate the second argument if the first argument is None. You cannot
> do this with a function, other than with a hack like a lambda
> function.
We keep running up
On Sun, Jul 22, 2018 at 05:09:39PM +0200, Giampaolo Rodola' wrote:
> > > I personally don't find "a ?? b" too bad (let's say I'm -0 about it)
> > > but idioms such as "a?.b", "a ??= b" and "a?[3] ?? 4" look too
> > > Perl-ish to me, non pythonic and overall not explicit, no matter what
> > > the c
On Mon, Jul 23, 2018 at 12:59:20AM +0200, Giampaolo Rodola' wrote:
> You're back at "since we have X that justifies the addition of Y" [1]
> and AFAICT that's the only argument you have provided so far in a 100+
> messages discussion.
The PEP itself justifies the addition of Y.
Chris' argument,
On Mon, Jul 23, 2018 at 2:38 AM Steven D'Aprano wrote:
>
> On Mon, Jul 23, 2018 at 12:59:20AM +0200, Giampaolo Rodola' wrote:
>
> > You're back at "since we have X that justifies the addition of Y" [1]
> > and AFAICT that's the only argument you have provided so far in a 100+
> > messages discussi
39 matches
Mail list logo