Re: [Python-ideas] Proposed alternative postfix syntax [was PEP 505: None-aware operators]

2018-07-29 Thread Abe Dillon
Typo: *You can usually guess that, since `person` isn't a local variable, we're probably dealing with a generator *comprehension* On Sun, Jul 29, 2018 at 11:00 PM, Abe Dillon wrote: > [Steven D'Aprano] > >> really wish you would stop talking about "natural language" as if >> there were only one

Re: [Python-ideas] Proposed alternative postfix syntax [was PEP 505: None-aware operators]

2018-07-29 Thread Abe Dillon
[Steven D'Aprano] > really wish you would stop talking about "natural language" as if > there were only one (and it were English). I'm fine with that. I've just had someone jump down my throat before about being overly English-centric when talking about readability. [Steven D'Aprano] > even

Re: [Python-ideas] Start argument for itertools.accumulate() [Was: Proposal: A Reduce-Map Comprehension and a "last" builtin]

2018-07-29 Thread Tim Peters
Since this started, I've been using variants of the following in my own code, wrapping `accumulate`: from itertools import accumulate, chain, cycle, islice def accum(iterable, func=None, *, initial=None, skipfirst=False): if initial is not None: iterable =

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread Nicholas Chammas
On Sun, Jul 29, 2018 at 10:58 AM Steven D'Aprano wrote: > On Sun, Jul 29, 2018 at 06:32:19AM -0400, David Mertz wrote: > > On Sun, Jul 29, 2018, 2:00 AM Steven D'Aprano > wrote: > > > > > Fine. So it takes them an extra day to learn one more operator. Big > > > deal. It is commonly believed to

Re: [Python-ideas] Proposed alternative postfix syntax [was PEP 505: None-aware operators]

2018-07-29 Thread Abe Dillon
[Steve D'Aprano] > so you absolutely are claiming that dot access "isn't *that* different" > from the possessive in English. Only in the context that I gave: `person.name`. In other contexts (e.g. thing.is_metal) the possessive analogy is obviously inaccurate, but I didn't make the broad claim

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread Abe Dillon
[Chris Angelico] > Almost. Except for the problem that "disgusting" is a subjective term. Yes. Thank you for explaining the joke. [Brice Parent] > I don't believe we need spam.eggs.cheese.aardvark? (there is exactly the > same number of use cases). We win a bit in readability as it's closer

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread Steven D'Aprano
On Sun, Jul 29, 2018 at 06:32:19AM -0400, David Mertz wrote: > On Sun, Jul 29, 2018, 2:00 AM Steven D'Aprano wrote: > > > Fine. So it takes them an extra day to learn one more operator. Big > > deal. It is commonly believed to take ten years to master a field or > > language. Amortize that one

Re: [Python-ideas] Proposed alternative postfix syntax [was PEP 505: None-aware operators]

2018-07-29 Thread David Mertz
On Sun, Jul 29, 2018, 7:46 AM Steven D'Aprano wrote: > One of the problems with David Mertz's counter-proposal for a magic > None-aware proxy is that we can't tell the difference between spam.eggs > and spam.eggs where one of them is magic and the other is not. So we have a > nice, clear,

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread Chris Angelico
On Sun, Jul 29, 2018 at 8:32 PM, David Mertz wrote: > I can hardly imagine a stronger bug magnet than PEP 505. The hyperbole in this thread is impressive. Not just "I can hardly imagine anyone PROPOSING a stronger bug magnet". You cannot imagine one even existing. And this is after people have

[Python-ideas] Proposed alternative postfix syntax [was PEP 505: None-aware operators]

2018-07-29 Thread Steven D'Aprano
On Sun, Jul 29, 2018 at 02:12:22AM -0500, Abe Dillon wrote: [I said this] > > Python is very little like natural language. Your earlier idea that > > attribute access spam.eggs is like natural language (in English) because > > its only a few characters different from "spam's eggs" really doesn't

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread Brice Parent
Le 29/07/2018 à 09:12, Abe Dillon a écrit : [...] NO! I'm proposing: spam.eggs.cheese.aardvark? A single POSTFIX operator that has a high priority in the order of operations. I don't believe we need spam?.eggs.cheese?.aardvark, because I don't think it is justified by the small benefits

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread Brice Parent
Le 29/07/2018 à 08:02, Steven D'Aprano a écrit : On Sun, Jul 29, 2018 at 12:49:13PM +1200, Greg Ewing wrote: Abe Dillon wrote: others countering that `person.name ` is not how periods are used in natural languages, so using other symbols in unintuitive ways is perfectly

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread David Mertz
On Sun, Jul 29, 2018, 2:00 AM Steven D'Aprano wrote: > Fine. So it takes them an extra day to learn one more operator. Big > deal. It is commonly believed to take ten years to master a field or > language. Amortize that one day over ten years and its virtually > nothing. > This is where being

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread Chris Angelico
On Sun, Jul 29, 2018 at 5:12 PM, Abe Dillon wrote: > The syntax of this proposal is almost objectively disgusting. It's truly > horrid. I don't know how many ways to say it. Almost. Except for the problem that "disgusting" is a subjective term. If you want to say that this is *objectively

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread Abe Dillon
First of all: Thanks to everyone for explaining everything about the id function. You are all so smart... [Greg Ewing] > Dots have been used for attribute access in so many languages > for so long that it has become the normal and expected syntax > to use. ?. is much more recent. Maybe in

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread Chris Angelico
On Sun, Jul 29, 2018 at 3:54 PM, Steven D'Aprano wrote: > Being an implementation detail, CPython is free to change it at any > time, without warning or notice, even in a bug-fix release. If CPython > ever gets a memory manager that can move objects around, as they can > move in Jython and

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread Steven D'Aprano
On Sun, Jul 29, 2018 at 12:49:13PM +1200, Greg Ewing wrote: > Abe Dillon wrote: > >others countering that `person.name ` is not how > >periods are used in natural languages, so using other symbols in > >unintuitive ways is perfectly fine. > > Dots have been used for

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-29 Thread Steven D'Aprano
On Sat, Jul 28, 2018 at 10:56:13PM -0500, Abe Dillon wrote: > > > > Python does not have memory locations. > > > > CPython does, form the documentation on the `id` function: No, that is the same id() function as the id() provided by Jython, and IronPython, and Stackless. Like all Python