[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-19 Thread Piotr Waszkiewicz
Thank you very much for this exhaustive explanation and example. I really like it and agree with you that the implementation provided by your example is much more well designed. The problem I have with it is that I feel like it assumes that I have a way to introduce such changes when writing the

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-19 Thread Paul Moore
On Tue, 19 Oct 2021 at 00:55, Guido van Rossum wrote: > > I should have added that I also don't feel I want to go at bat to fight for > this PEP. I do observe that it looks like the folks used to building large > systems (in Python or other languages) don't seem to like it, while it seems > to

[Python-Dev] Re: compiled python3.10 is unable to find _ssl

2021-10-19 Thread Robin Becker
On 18/10/2021 18:50, Senthil Kumaran wrote: Your configure script did pick up openssl as the support version was not found. What is your operating system? Make sure you have supported version of ssl. Python requires openssl 1.1.1 or higher. ... I tried to build this on ubuntu 18.04, but

[Python-Dev] Re: compiled python3.10 is unable to find _ssl

2021-10-19 Thread Christian Heimes
On 19/10/2021 11.57, Robin Becker wrote: On 18/10/2021 18:50, Senthil Kumaran wrote: Your configure script did pick up openssl as the support version was not found. What is your operating system? Make sure you have supported version of ssl. Python requires openssl 1.1.1 or higher. ... I

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-19 Thread Doug Swarin
I will also say that I don't believe the safe-navigation operators necessarily compromise type safety. PEP 505 explicitly rejects having them catch `AttributeError` or `KeyError` (and I agree with this rejection). It's not the default behavior of objects to return None when an unknown attribute

[Python-Dev] Re: compiled python3.10 is unable to find _ssl

2021-10-19 Thread Christian Heimes
On 19/10/2021 17.26, Robin Becker wrote: On 19/10/2021 11:21, Christian Heimes wrote: On 19/10/2021 11.57, Robin Becker wrote: .. For PEP 644 I added new instructions how to build Python 3.10 with custom OpenSSL builds. The instructions should work on all major Linux distributions.

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-19 Thread Baptiste Carvello
Le 18/10/2021 à 20:26, Guido van Rossum a écrit : > > y = None  # Default > if config is not None: >   handler = config.get("handler") >   if handler is not None: >     parameters = handler.get("parameters") >     if parameters is not None: >   y = parameters.get("y") > > […] > Using ?. this

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-19 Thread Jim J. Jewett
Steve Dower wrote: > Okay, I'll let myself get sucked into responding ONE TIME, but only > because you gave me such a nice API to work with :) This actually pushed me hard towards adding the null-aware operators. I agree that the named-function approach Paul suggests is better. I admit that

[Python-Dev] Re: compiled python3.10 is unable to find _ssl

2021-10-19 Thread Robin Becker
On 19/10/2021 11:21, Christian Heimes wrote: On 19/10/2021 11.57, Robin Becker wrote: .. For PEP 644 I added new instructions how to build Python 3.10 with custom OpenSSL builds. The instructions should work on all major Linux distributions. They have been tested on Debian-like and

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-19 Thread Chris Angelico
On Wed, Oct 20, 2021 at 3:25 AM Baptiste Carvello wrote: > > Le 18/10/2021 à 20:26, Guido van Rossum a écrit : > > > > y = None # Default > > if config is not None: > > handler = config.get("handler") > > if handler is not None: > > parameters = handler.get("parameters") > > if

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-19 Thread Michael Selik
On Tue, Oct 19, 2021 at 9:39 AM Chris Angelico wrote: > On Wed, Oct 20, 2021 at 3:25 AM Baptiste Carvello > wrote: > > > > Le 18/10/2021 à 20:26, Guido van Rossum a écrit : > > > > > > y = None # Default > > > if config is not None: > > > handler = config.get("handler") > > > if handler is

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-19 Thread h . vetinari
Baptiste Carvello wrote: > y = config["handler"]["parameters"]["y"] with KeyError as None I love the look of this! While it doesn't address everything that PEP505 does, that's IMO a good thing, because - as other people mentioned already - None does too many things already. On another note,

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-10-19 Thread Victor Stinner
Extra info that I didn't put in the PEP to keep the PEP short. Since Python 3.8, multiple macros have already been converted, including Py_INCREF() and Py_TYPE() which are very commonly used and so matter for Python performance. Macros converted to static inline functions: * Py_INCREF(),

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-10-19 Thread Victor Stinner
One of my motivation to write this PEP was decide how to solve the issue: "[C API] Disallow using PyFloat_AS_DOUBLE() as l-value" https://bugs.python.org/issue45476 I proposed two fixes: * Convert macros to static inline functions: https://github.com/python/cpython/pull/28961 * Fix the macro,

[Python-Dev] PEP 670: Convert macros to functions in the Python C API

2021-10-19 Thread Victor Stinner
Hi, Erlend and me wrote a PEP to move away from macros in the Python C API. We are now waiting for feedback :-) Read the PEP online: https://www.python.org/dev/peps/pep-0670/ There is a copy of the PEP below for inline replies. Victor --- PEP: 670 Title: Convert macros to functions in the