Re: [Python-ideas] Can we add "zip and assert equal length" to the standard library?

2018-07-28 Thread Jonathan Fine
Hi All I've followed my own advice, earlier in this thread. The newly created repository https://github.com/jfine2358/py-jfine2358 contains personal Python code that others might find useful. And you'll find in it: === https://github.com/jfine2358/py-jfine2358/blob/master/jfine2358/itertools.py

Re: [Python-ideas] Change repr of collections.OrderedDict to be more dict-like

2018-07-28 Thread Miro Hrončok
On 28.7.2018 07:27, Tim Peters wrote: [David Mertz]  > I often use doctests to verify APIs and behaviors when I update code. I > know I'm in a minority and most developers slightly disparage doctests. [Steven D'Aprano] I don't know why you think that "most developers" disparage doctests.

Re: [Python-ideas] As-do statements/anonymous blocks in python

2018-07-28 Thread James Lu
By passing a function to another function I meant passing a code block as an inline function to a function call. The do statement is simply the arguments the function is called with Brackets = optional as expr [do comma-separated-expressions]: block means evaluate expr, then call the result

Re: [Python-ideas] As-do statements/anonymous blocks in python

2018-07-28 Thread Jonathan Fine
Hi James This is an attempt to respond to the issues that be lying behind your request for code blocks in Python. It's my two cents worth (https://en.wikipedia.org/wiki/My_two_cents) of opinion. I really do wish we could have language that had all of Ruby's strengths, and also all of Python's. Th

Re: [Python-ideas] slice[] to get more complex slices

2018-07-28 Thread Jonathan Fine
Hi Stephan I took a look at your personal web site. Your PhD sounds interesting. Quantum coherence and photosynthesis. But off-topic here. (Sadly, personal web sites are a bit of mess.) You wrote: > I'd really like to move this proposal forward in some form. +10 > As a next step, would it be he

Re: [Python-ideas] Change repr of collections.OrderedDict to be more dict-like

2018-07-28 Thread Eric V. Smith
On 7/28/2018 7:02 AM, Miro Hrončok wrote: On 28.7.2018 07:27, Tim Peters wrote: In any case, since OrderedDict seems to be viewed as a legacy feature now, making any change to it is an odd idea on the face of it. As far as I understood the discussions on python-dev, it is not viewed as legacy

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

2018-07-28 Thread Abe Dillon
> > We could argue about how intuitive or not these operators are, but they > are used in other languages, so they clearly aren't completely unintuitive. Other languages are other languages. Other languages use the " ? : " form of the the ternary operator. That doesn't mean we should adopt that

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

2018-07-28 Thread Chris Angelico
On Sun, Jul 29, 2018 at 6:07 AM, Abe Dillon wrote: > Yes, I thought of that and came to the same conclusion. It's my > understanding that None may not be an actual object, but a special memory > location. I'm not sure though and didn't look it up. Python does not have memory locations. None *is*

Re: [Python-ideas] As-do statements/anonymous blocks in python

2018-07-28 Thread Greg Ewing
James Lu wrote: as expr [do comma-separated-expressions]: >block means evaluate expr, then call the result of the expression. If do is present, call it with the argument list after do. This kind of thing has been proposed before. Although it seems like a straightforward idea, there are s

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

2018-07-28 Thread Abe Dillon
> > Python does not have memory locations. > CPython does, form the documentation on the `id` function: *CPython implementation detail:* This is the address of the object in > memory. I'm not sure what performance implications there would be for adding a __none_check__ or whatever method to Non

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

2018-07-28 Thread Chris Angelico
On Sun, Jul 29, 2018 at 1:56 PM, Abe Dillon wrote: >> Python does not have memory locations. > > > CPython does, form the documentation on the `id` function: > >> CPython implementation detail: This is the address of the object in >> memory. Right, which is an important distinction; CPython, bein

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

2018-07-28 Thread Greg Ewing
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 attribute access in so many languages for so long that it has become the normal an

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

2018-07-28 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 implemen

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

2018-07-28 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 attribute

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

2018-07-28 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 IronPyt