On Tue, Jul 24, 2018 at 07:02:54AM -0400, David Mertz wrote:
> On Tue, Jul 24, 2018, 5:50 AM Steven D'Aprano wrote:
>
> > But what certainly *is* implicity is David Mertz' suggestion for a
> > magical None-aware proxy:
> >
> > x.attribute
> >
> > The only way to tell whether that was an ordin
On Tue, Jul 24, 2018 at 08:07:36AM -0400, Richard Damon wrote:
> The fact that you changed NullCoalesce into Foo to show lack of
> explicitness seems a straw-man.
I understood Rhodri as making the point that if you don't know what
NullCoalesce means or does, it might as well be called Foo. Ther
On Wed, Jul 25, 2018 at 12:12:40PM -0400, Nicholas Chammas wrote:
> When something is "explicit", as I understand it, that means it does what
> it says on the cover. There is no unstated behavior. The plain meaning of
> `v = a?.b` is that it expands to the longer form (`v = a; if a.b ...`), and
>
David Mertz wrote:
Sorry. From my tablet. "Bug magnets" (it really, really wants to
autocorrect that)
At least it didn't correct it to "butt magnets". :-)
--
Greg
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/l
*sorry, cat hit "send"...
Just reading those examples made me want to cry and go hide in a dark dark
cave and never come out. I'm sure using actual variable names would help a
bit, but not much.
As for the non-english nature of:
value = person.name
I highly disagree with the argument that since
>
> The two statements you wrote are not the same. The first statement will
> error out if person is None.
That's my bad. I was copying off of an erroneous example. Thanks for
correcting me.
The proposed None-aware operators are specifically designed to handle
> variables that may be None.
>
Yes,
On Wed, Jul 25, 2018 at 6:11 PM Abe Dillon wrote:
> The problem here is not whether it's explicit. It's about Readability and
> conciseness. Using symbols in place of words almost always harms
> readability in favor of conciseness.
>
> value = person.name if person.name else person
>
> almost rea
Sorry. From my tablet. "Bug magnets" (it really, really wants to
autocorrect that)
And yes, the problem is that the equivalent is actually:
v = a
if v is not None: v=a.b
The semantics are simply not the ones that are intuitive to most people
reading 'v = a?.b'
On Wed, Jul 25, 2018, 7:01
On Wed, Jul 25, 2018 at 3:11 PM Abe Dillon wrote:
> The problem here is not whether it's explicit. It's about Readability and
> conciseness. Using symbols in place of words almost always harms
> readability in favor of conciseness.
>
> value = person.name if person.name else person
>
> almost rea
>
> The fact that a while bunch have people have commented on this subthread
> while not recognizing that the semantics of the '?.' and the if blocks are
> entirely different suggests the operators are but magnets.
>
Can you explain? What do you mean by "the operators are but magnets"?
The "None
On Wed, Jul 25, 2018 at 6:36 PM David Mertz wrote:
> The fact that a while bunch have people have commented on this subthread
> while not recognizing that the semantics of the '?.' and the if blocks are
> entirely different suggests the operators are but magnets.
>
> On Wed, Jul 25, 2018, 5:17 PM
The fact that a while bunch have people have commented on this subthread
while not recognizing that the semantics of the '?.' and the if blocks are
entirely different suggests the operators are but magnets.
On Wed, Jul 25, 2018, 5:17 PM Nicholas Chammas
wrote:
> On Mon, Jul 23, 2018 at 6:05 PM G
The problem here is not whether it's explicit. It's about Readability and
conciseness. Using symbols in place of words almost always harms
readability in favor of conciseness.
value = person.name if person.name else person
almost reads like english (aside from being a weird and totally uncommon
u
On Wed, Jul 25, 2018 at 12:12 PM Nicholas Chammas <
nicholas.cham...@gmail.com> wrote:
> On Mon, Jul 23, 2018 at 6:05 PM Giampaolo Rodola'
> wrote:
>
>> This:
>>
>> v = a?.b
>>
>> ...*implicitly* checks if value is not None [and continues execution].
>> This:
>>
>> v = a
>> if a.b is
On Mon, Jul 23, 2018 at 6:05 PM Giampaolo Rodola'
wrote:
> This:
>
> v = a?.b
>
> ...*implicitly* checks if value is not None [and continues execution].
> This:
>
> v = a
> if a.b is not None:
> v = a.b
>
> ...*explicitly* checks if value is not None and continues execution.
>
On Tue, Jul 24, 2018, 9:09 AM Chris Angelico wrote:
> >>> x = Foo(cfg).user.profile
> >>> x.food
>
> Remember, these lines could be a very long way apart. You could pass
> 'x' to a function unrelated to the line of code that created it. And
> 'x.food' still has to have the magic. You can't mandat
I *definitely* don't think a little tool I wrote in a couple hours last
night belongs in the standard library (with most of the heavy lifting
actually done by wrapt—which is really well designed, and is also not in
the standard library). I also don't think PyMaybe belongs there, even
though it's a
On Tue, Jul 24, 2018 at 11:02 PM, David Mertz wrote:
> On Tue, Jul 24, 2018, 7:38 AM Rhodri James wrote:
>>
>> On 24/07/18 12:02, David Mertz wrote:
>> > Every use I've suggested for the magic proxy is similar to:
>> >
>> >NullCoalesce(cfg).user.profile.food
>> >
>> > Yes, the class is magic.
On 24/07/18 14:02, David Mertz wrote:
On Tue, Jul 24, 2018, 7:38 AM Rhodri James wrote:
I'm still of the opinion that both approaches are trying to solve a
problem that's too niche to merit them, BTW.
That doesn't make sense to me. You think my little library shouldn't be
allowed on PyPI? I
On Tue, Jul 24, 2018, 7:38 AM Rhodri James wrote:
> On 24/07/18 12:02, David Mertz wrote:
> > Every use I've suggested for the magic proxy is similar to:
> >
> >NullCoalesce(cfg).user.profile.food
> >
> > Yes, the class is magic. That much more so in the library I published
> last
> > night t
On 24/07/18 13:07, Richard Damon wrote:
The fact that you changed NullCoalesce into Foo to show lack of explicitness
seems a straw-man. Words are FULL of meaning, while symbols are less so. The
biggest issue I see with the use of ? here is that ? does have some meaning, it
says we are going to
Both approaches should not be exposed as core language, but as facilitating
tools to be used if, in your application, you have to traverse deep
semi-regular attributes hierarchies.
The operator approach, by definition, is part of the core, so -1
The wrapper does not need to be included in python,
> On Jul 24, 2018, at 7:37 AM, Rhodri James wrote:
>
>> On 24/07/18 12:02, David Mertz wrote:
>> Every use I've suggested for the magic proxy is similar to:
>> NullCoalesce(cfg).user.profile.food
>> Yes, the class is magic. That much more so in the library I published last
>> night that utili
On 24/07/18 12:56, Grégory Lielens wrote:
On Tuesday, July 24, 2018 at 1:38:42 PM UTC+2, Rhodri James wrote:
-snip-
I'm still of the opinion that both approaches are trying to solve a
problem that's too niche to merit them, BTW.
That's also my impression. Hence the second approach: it does no
On Tuesday, July 24, 2018 at 1:38:42 PM UTC+2, Rhodri James wrote:
>
> -snip-
> I'm still of the opinion that both approaches are trying to solve a
> problem that's too niche to merit them, BTW.
That's also my impression. Hence the second approach: it does not require
any change to python, i
On 24/07/18 12:02, David Mertz wrote:
Every use I've suggested for the magic proxy is similar to:
NullCoalesce(cfg).user.profile.food
Yes, the class is magic. That much more so in the library I published last
night that utilizes wrapt.ObjectProxy. But it's also pretty explicit in
that an act
On Tue, Jul 24, 2018, 5:50 AM Steven D'Aprano wrote:
> But what certainly *is* implicity is David Mertz' suggestion for a
> magical None-aware proxy:
>
> x.attribute
>
> The only way to tell whether that was an ordinary attribute lookup or a
> none-aware lookup would be to carefully inspect x
On Tue, Jul 24, 2018 at 11:50 AM Steven D'Aprano wrote:
>
> On Tue, Jul 24, 2018 at 12:05:14AM +0200, Giampaolo Rodola' wrote:
>
> > This:
> >
> > v = a?.b
> >
> > ...*implicitly* checks if value is not None [and continues execution].
>
> Do you agree that:
>
> obj.attribute
> x + 1
>
On Tue, Jul 24, 2018 at 12:05:14AM +0200, Giampaolo Rodola' wrote:
> This:
>
> v = a?.b
>
> ...*implicitly* checks if value is not None [and continues execution].
Do you agree that:
obj.attribute
x + 1
func(arg)
explicitly looks up an attribute on obj, explicitly adds 1 to x,
On Tue, Jul 24, 2018 at 2:22 AM MRAB wrote:
> >> > It
> >> > does so by introducing a brand new operator ("?") which can be spelled
> >> > in two forms ("a?.b" and "a?[b]") by using two adjacent symbols not
> >> > interrupted by any space, which is an absolute first in the Python
> >> > syntax
>
On 24 July 2018 at 08:38, Grégory Lielens wrote:
>
>
> On Tuesday, July 24, 2018 at 9:28:02 AM UTC+2, Brice Parent wrote:
>>
>> Le 24/07/2018 à 00:39, Chris Angelico a écrit :
>> > On Tue, Jul 24, 2018 at 8:22 AM, Thomas Jollans wrote:
>> ...
>> > What about:
>> >
>> > 5 < x < 10
>> >
>> > Can yo
On Tuesday, July 24, 2018 at 9:28:02 AM UTC+2, Brice Parent wrote:
>
> Le 24/07/2018 à 00:39, Chris Angelico a écrit :
> > On Tue, Jul 24, 2018 at 8:22 AM, Thomas Jollans > wrote:
> ...
> > What about:
> >
> > 5 < x < 10
> >
> > Can you add parentheses to that to "make precedence and evaluation
On Tue, Jul 24, 2018 at 5:26 PM, Brice Parent wrote:
> Le 24/07/2018 à 00:39, Chris Angelico a écrit :
>>
>> On Tue, Jul 24, 2018 at 8:22 AM, Thomas Jollans wrote:
>
> ...
>>
>> What about:
>>
>> 5 < x < 10
>>
>> Can you add parentheses to that to "make precedence and evaluation order
>> clear"?
Le 24/07/2018 à 00:39, Chris Angelico a écrit :
On Tue, Jul 24, 2018 at 8:22 AM, Thomas Jollans wrote:
...
What about:
5 < x < 10
Can you add parentheses to that to "make precedence and evaluation order clear"?
Correct me if I'm wrong, but to my knowledge, this is just a shorthand
to `5 < x
On 2018-07-23 23:05, Giampaolo Rodola' wrote:
On Mon, Jul 23, 2018 at 6:53 PM Steven D'Aprano wrote:
On Mon, Jul 23, 2018 at 02:04:17PM +0200, Giampaolo Rodola' wrote:
> "a?.b" does two and that's a fundamental difference (explicitness).
How is "two things" less explicit than "one thing"?
Com
On 24/07/18 00:39, Chris Angelico wrote:
> On Tue, Jul 24, 2018 at 8:22 AM, Thomas Jollans wrote:
>> On 18/07/18 19:43, Steve Dower wrote:
>>> When a ``None``-aware operator is present, the left-to-right evaluation
>>> may be
>>> short-circuited. For example, ``await a?.b(c).d?[e]`` is evaluated::
On Tue, Jul 24, 2018 at 8:22 AM, Thomas Jollans wrote:
> On 18/07/18 19:43, Steve Dower wrote:
>> When a ``None``-aware operator is present, the left-to-right evaluation
>> may be
>> short-circuited. For example, ``await a?.b(c).d?[e]`` is evaluated::
>>
>> _v = a
>> if _v is not None:
>>
On 18/07/18 19:43, Steve Dower wrote:
> When a ``None``-aware operator is present, the left-to-right evaluation
> may be
> short-circuited. For example, ``await a?.b(c).d?[e]`` is evaluated::
>
> _v = a
> if _v is not None:
> _v = _v.b
> _v = _v(c)
> _v = _v.d
>
On Tue, Jul 24, 2018 at 8:05 AM, Giampaolo Rodola' wrote:
> The argument about this is that '?.' short-circuits execution
> *silently*. Instead of AttributeError you get None. You may chain ?.
> in order to lazily traverse a long tree, inadvertently assign None to
> a variable, continue code execu
On Mon, Jul 23, 2018 at 6:53 PM Steven D'Aprano wrote:
>
> On Mon, Jul 23, 2018 at 02:04:17PM +0200, Giampaolo Rodola' wrote:
> > "a?.b" does two and that's a fundamental difference (explicitness).
>
> How is "two things" less explicit than "one thing"?
> Comments like the above is why I think tha
On Sun, Jul 22, 2018 at 11:54:19AM +1000, Steven D'Aprano wrote:
> 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:
>
> expressio
On 2018-07-23 13:04, Giampaolo Rodola' wrote:
On Mon, Jul 23, 2018 at 3:12 AM Steven D'Aprano wrote:
> ? has no spaces, it's literally "variable names interrupted by
> question marks" and evaluation can stop at any time while scanning the
> line from left to right.
Just like ordinary attribute
On 2018-07-23 10:51, Steve Dower wrote:
[snip]
False: 'a?.b' is totally different from 'a.b'
-
The expression 'a.b' either results in 'a.b' or AttributeError (assuming
no descriptors are involved).
The expression 'a?.b' either results in 'a.b' or Non
On Mon, Jul 23, 2018 at 02:04:17PM +0200, Giampaolo Rodola' wrote:
[I wrote this]
> > This is the point I was making earlier: you accept existing punctuation
> > doing these things:
> >
> > try:
> > obj.spam.egsg.tomato.cheese # oops a typo
> > except AttributeError:
> > #
I personally do almost only classical programming, and I am somewhat
opposed to OOP in general. So here my somewhat outlandish view,
(and I am biased becase I will probably never need this feature).
First thoughts after reading the PEP: what is so super-special and fundamental
about None value?
Is
On 23Jul2018 1530, David Mertz wrote:
Of course I don't mean that if implemented the semantics
would be ambiguous... rather, the proper "swallowing" of different kinds
of exceptions is not intuitively obvious, not even to you, Steve. And
if some decision was reached and documented, it would re
On Mon, Jul 23, 2018 at 7:46 AM, Grégory Lielens
wrote:
> Paul Moore wrote:
>>
>> This is my impression, as well. It seems like something that's helpful
>> in dealing with unstructured object hierarchies with lots of optional
>> attributes - which is where JSON tends to be used.
>>
>> But given
On Mon, Jul 23, 2018 at 12:09:00PM +0100, Steve Dower wrote:
> On 23Jul2018 1145, Antoine Pitrou wrote:
> >
> >Le 23/07/2018 à 12:38, Steve Dower a écrit :
> >>
> >>General comment to everyone (not just Antoine): these arguments have
> >>zero value to me. Feel free to keep making them, but I am uni
On Mon, Jul 23, 2018 at 11:52 AM Steve Dower wrote:
> I'm borderline on ?[] right now. Honestly, I think it works best if it
> also silently handles LookupError (e.g. for traversing a loaded JSON
> dict), but then it's inconsistent with ?. which I think works best if it
> handles None but allows
On Mon, Jul 23, 2018 at 5:52 AM Steve Dower wrote:
> The PEP author is unsure about how it works
> ---
> I wish this statement had come with some context, because the only thing
> I'm unsure about is what I'm supposed to be unsure about.
>
In general—as I
On Mon, Jul 23, 2018 at 6:52 AM Steve Dower wrote:
> Responding to a few more ideas that have come up here.
>
Thank you for the clarifications.
I'm trying to wrap my head around the various facets of None aware
operators proposal after reading the whole discussion - as well as having
read t
On Mon, Jul 23, 2018 at 10:48:23AM +0100, Steve Dower wrote:
> On 23Jul2018 0151, Steven D'Aprano wrote:
> >What if there was a language
> >supported, non-hackish way to officially delay evaluation of
> >expressions until explicitly requested?
>
> The current spelling for this is "lambda: delayed-
On Mon, Jul 23, 2018 at 2:37 PM Mark E. Haase wrote:
>> What does a scan through the existing core library say?
>
>
> Please read the PEP before you shoot it down. It answers this _exact_
> question.
My apologies. I'd missed the line where it says the examples were
taken from the core library.
On Mon, Jul 23, 2018 at 2:23 AM Nicholas Cole
wrote:
> One issue for me is that the trivial case is already a one-liner:
>
> if a is None: a = 10
>
Yes, if you have no indentation and a 1-character name, then it fits on a
single line. If you have a longer expression and/or side effects, then it'
Paul Moore wrote:
>
> This is my impression, as well. It seems like something that's helpful
> in dealing with unstructured object hierarchies with lots of optional
> attributes - which is where JSON tends to be used.
>
> But given that, I'm really much more interested in seeing the new
> operator
On Mon, Jul 23, 2018 at 3:12 AM Steven D'Aprano wrote:
> > ? has no spaces, it's literally "variable names interrupted by
> > question marks" and evaluation can stop at any time while scanning the
> > line from left to right.
>
> Just like ordinary attribute access.
>
> This is the point I was mak
On 23 July 2018 at 12:39, Grégory Lielens wrote:
> Maybe it would help if you mention in which context you will benefit the
> most? If the python sub-community related to this context agree "?? and
> friends" is a good idea, then it will add weight to the proposal. Else,
> probably better to forge
Maybe it would help if you mention in which context you will benefit the
most? If the python sub-community related to this context agree "?? and
friends" is a good idea, then it will add weight to the proposal. Else,
probably better to forget it.
It seems related to JSON, but as I have never us
Le 23/07/2018 à 13:09, Steve Dower a écrit :
> On 23Jul2018 1145, Antoine Pitrou wrote:
>>
>> Le 23/07/2018 à 12:38, Steve Dower a écrit :
>>>
>>> General comment to everyone (not just Antoine): these arguments have
>>> zero value to me. Feel free to keep making them, but I am uninterested.
>>
>>
On Mon, Jul 23, 2018 at 8:08 AM Grégory Lielens
wrote:
>
>
>
> On Monday, July 23, 2018 at 8:24:45 AM UTC+2, Nicholas Cole wrote:
>
>> And that leads to a simple question: how many times does this actually
>> occur in real-world by python code? -- i.e. how many times do I want
>> to check the valu
On 23Jul2018 1145, Antoine Pitrou wrote:
Le 23/07/2018 à 12:38, Steve Dower a écrit :
General comment to everyone (not just Antoine): these arguments have
zero value to me. Feel free to keep making them, but I am uninterested.
So you're uninterested in learning from past mistakes?
You sound
Le 23/07/2018 à 12:38, Steve Dower a écrit :
>
> General comment to everyone (not just Antoine): these arguments have
> zero value to me. Feel free to keep making them, but I am uninterested.
So you're uninterested in learning from past mistakes?
You sound like a child who thinks their demand
On 23Jul2018 1129, Antoine Pitrou wrote:
Le 23/07/2018 à 12:25, Steve Dower a écrit :
On 23Jul2018 , Antoine Pitrou wrote:
On Mon, 23 Jul 2018 10:51:31 +0100
Steve Dower wrote:
Which is the most important operator?
-
Personally, I think '?.' is the m
Le 23/07/2018 à 12:25, Steve Dower a écrit :
> On 23Jul2018 , Antoine Pitrou wrote:
>> On Mon, 23 Jul 2018 10:51:31 +0100
>> Steve Dower wrote:
>>>
>>> Which is the most important operator?
>>> -
>>>
>>> Personally, I think '?.' is the most valuable.
>>
>>
On 23Jul2018 , Antoine Pitrou wrote:
On Mon, 23 Jul 2018 10:51:31 +0100
Steve Dower wrote:
Which is the most important operator?
-
Personally, I think '?.' is the most valuable.
For me, it's the most contentious. The fact that a single '?' added to
a
On Mon, 23 Jul 2018 10:51:31 +0100
Steve Dower wrote:
>
> Which is the most important operator?
> -
>
> Personally, I think '?.' is the most valuable.
For me, it's the most contentious. The fact that a single '?' added to
a regular line of Python code can sh
Responding to a few more ideas that have come up here. Again, apologies
for not directing them to the original authors, but I want to focus on
the ideas that are leading towards a more informed decision, and not
getting distracted by providing customised examples for people or
getting into side
On 23Jul2018 0151, Steven D'Aprano wrote:
What if there was a language
supported, non-hackish way to officially delay evaluation of
expressions until explicitly requested?
The current spelling for this is "lambda: delayed-expression" and the
way to request the value is "()". :)
(I'm not even
On Monday, July 23, 2018 at 8:24:45 AM UTC+2, Nicholas Cole wrote:
And that leads to a simple question: how many times does this actually
> occur in real-world by python code? -- i.e. how many times do I want
> to check the value of an existing label, and, finding it is None (and
> None speci
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
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 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 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 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 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 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 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, 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 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 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, 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 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 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 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 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 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
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 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
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
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
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
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: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
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, 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
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 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
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
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://pyt
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
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
101 - 200 of 300 matches
Mail list logo