Re: [Python-ideas] Repurpose `assert' into a general-purpose check

2017-11-27 Thread Nathan Schneider
On Mon, Nov 27, 2017 at 9:28 PM, Ivan Pozdeev via Python-ideas < python-ideas@python.org> wrote: > On 28.11.2017 5:19, Chris Angelico wrote: > > Actually, Python does have a way of disabling assertions (the -O >> flag), so they should be treated the same way they are in C. >> Assertions should

Re: [Python-ideas] a sorting protocol dunder method?

2017-12-03 Thread Nathan Schneider
On Sun, Dec 3, 2017 at 6:06 PM, Chris Barker wrote: > In fact, it's striking me that there may well be classes that are defining > the comparison magic methods not because they want the objects to "work" > with the comparison operators, but because that want them to work

Re: [Python-ideas] Crazy idea: allow keywords as names in certain positions

2018-05-13 Thread Nathan Schneider
Care would have to be taken in the grammar to avoid syntactic ambiguity. For example: x = 1 def not(x): ... if not - x: # Is this 'not' the keyword or the identifier? not (-x), or not minus x? ... Nathan On Sun, May 13, 2018 at 2:20 PM Guido van Rossum wrote: > As

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-21 Thread Nathan Schneider
On Thu, Mar 21, 2019 at 9:17 AM Serhiy Storchaka wrote: > 21.03.19 14:51, Chris Angelico пише: > > ... then, in the interests of productive discussion, could you please > > explain? What is it about dict addition that makes it harder to > > understand than other addition? > > Currently the +

Re: [Python-ideas] PEP 572: Assignment Expressions (post #4)

2018-04-11 Thread Nathan Schneider
On Wed, Apr 11, 2018 at 1:49 PM, Brendan Barnwell wrote: > On 2018-04-11 05:23, Clint Hepner wrote: > >> I find the assignments make it difficult to pick out what the final >> expression looks like. >> > > I strongly agree with this, and for me I think this is

Re: [Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)

2018-04-15 Thread Nathan Schneider
On Sat, Apr 14, 2018 at 11:54 PM, Chris Angelico wrote: > On Sun, Apr 15, 2018 at 1:08 PM, Nick Coghlan wrote: > > === Target first, 'from' keyword === > > > > while (value from read_next_item()) is not None: # New > > ... > > > > Pros: > > > >

Re: [Python-ideas] An alternative to PEP 572's Statement-Local Name Bindings

2018-03-04 Thread Nathan Schneider
On Sun, Mar 4, 2018 at 11:04 PM, Chris Angelico wrote: > On Mon, Mar 5, 2018 at 2:49 PM, Mike Miller > wrote: > > Yes, thanks: > > > > [ f(y), g(y) for x, h(x) as y in things ] > > > > > > Dyslexics untie! > > :) > > Hmm. The trouble here is that

Re: [Python-ideas] Add regex pattern literal p""

2018-12-28 Thread Nathan Schneider
On Sat, Dec 29, 2018 at 12:30 AM Alexander Heger wrote: > for regular strings one can write > > "aaa" + "bbb" > > which also works for f-strings, r-strings, etc.; in regular expressions, > there is, e.g., parameter counting and references to numbered matches. How > would that be dealt with in a

[Python-ideas] Re: zip(x, y, z, strict=True)

2020-04-25 Thread Nathan Schneider
On Sat, Apr 25, 2020 at 10:41 AM Steven D'Aprano wrote: > On Thu, Apr 23, 2020 at 09:10:16PM -0400, Nathan Schneider wrote: > > > How, for example, to collate lines from 3 potentially large files while > > ensuring they match in length (without an external dependency)? The best

[Python-ideas] Re: zip(x, y, z, strict=True)

2020-04-23 Thread Nathan Schneider
On Thu, Apr 23, 2020 at 3:50 PM Eric Fahlgren wrote: > On Wed, Apr 22, 2020 at 12:23 PM David Mertz wrote: > >> On Wed, Apr 22, 2020, 4:24 AM Antoine Pitrou >> >>> But, as far as I'm concerned, the number of times where I took >>> advantage of zip()'s current acceptance of heteregenously-sized

[Python-ideas] Re: [Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-17 Thread Nathan Schneider
On Sun, May 17, 2020 at 6:14 AM Rhodri James wrote: > On 16/05/2020 17:14, Guido van Rossum wrote: > > On Sat, May 16, 2020 at 1:26 AM Steven D'Aprano > wrote: > > > >>> * zip(strict=True) +1 > >>> * zip(mode='strict') -0 > >>> * itertools.zip_strict() -0.5 > >>> * zip.strict()

[Python-ideas] Re: [Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-17 Thread Nathan Schneider
On Sun, May 17, 2020 at 1:32 PM David Mertz wrote: > On Sun, May 17, 2020 at 12:22 PM Nathan Schneider > wrote: > >> Let me attempt a metaphor, which won't be perfect but may help: >> >> The safety one gets from strictness is a bit like driving a