The discussion the previous month about PEP 505 None-aware operators continues (second thread).
Ken Hilton suggests that an expression version of the with
statement would be useful. For example:
contents = f.read() with open('file') as f #the most obvious one
multiplecontents = [f.read() with open(name) as f for name in names] #reading multiple files
The rejected PEP 463 (Exception-catching expressions) is mentioned.
Todd suggests new operators and corresponding dunder methods for boolean and
, or
, not
, and xor
, so that projects that need custom behavior from these (e.g. numpy or sqlalchemy) need not abuse the existing bitwise operators. A discussion about allowing custom infix operators develops.
Fabrizio Messina proproses using curly braces as syntactic sugar for declaring partial functions.
Robert Vanden Eynde suggests using funcoperators (which is his project) for this.
Eventually the discussion descends into a less-than-polite argument about whether jargon is harmful. Some discussion follows about how to improve the quality of discourse, and eventually some more extensive discussion about the use of jargon, partciuarly centered on lambda
.
Ken Hilton suggests that it is problematic to yield
from inside a with
statement, because then the with
will stay open (e.g. leaving file handles open longer than expected).
Jonathan Fine announces a draft piece of documentation that introduces None
.
Marko Ristin-Kaufmann suggests that python should better support design by contract, giving icontract as an example of a python implementation of the idea.
Mike Barnett suggests that his project PySimpleGUI should be made part of the standard library, leading to some discussion of existing python GUI options.
James Lu suggests that it should be possible to use augmented assignment with iterables:
a = 0
b = 0
a, b += 1, 2
# a is now 1
# b is now 2