[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-11 Thread Guido van Rossum
s 2, right? > Good catch. That's actually undefined -- we want to let the optimizer have some leeway in how to generate the best code for matching. See https://www.python.org/dev/peps/pep-0622/#performance-considerations Currently it doesn't optimize all that much -- it just pro

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-11 Thread Guido van Rossum
Elixir's "pin" operator is `^` and works this way. I don't find it very intuitive that in order to write "it should be the same x twice" you have to spell it differently -- it's more a clever trick (that surely would become a hacker's idiom if we allowed it). -

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-11 Thread Guido van Rossum
elative to `match`. As MRAB said, it's a case of picking the least inelegant one. Let me add that the parser can easily deal with whatever we pick -- this is purely about human factors. -- --Guido van Rossum (python.org/~guido) *Pronouns

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-10 Thread Guido van Rossum
were all trying to get the `__match__` protocol to do different things. Also, beware that if your class does this, it is stuck with this form -- if you replace `["__self__"]` with some other set of arguments, user code that is matching against your class will presumably break. -- -

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-09 Thread Guido van Rossum
Yes, you’ve got that exactly right! I think the pep has an example for tuple((x, y)). On Thu, Jul 9, 2020 at 13:08 Rob Cliffe via Python-Dev < python-dev@python.org> wrote: > One thing I don't understand about the PEP: > > case [x,y]: > > IIUC matches any 2-element sequence. > How would you

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-09 Thread Guido van Rossum
27;===' as '==' followed by '=' and it would treat this as a syntax error. Also, it looks a lot like a JavaScript equivalency (?) operator. A single '=' prefix suffers from pretty much the same thing -- Python's tokenizer as well as the tokenizer in most people

[Python-Dev] Re: PEP 622 (match statement) playground

2020-07-08 Thread Guido van Rossum
It works for me. Did you click on the box where the logs are supposed to appear? It will only show the logs when you click there. On Wed, Jul 8, 2020 at 1:36 PM Henk-Jaap Wagenaar < wagenaarhenkj...@gmail.com> wrote: > On Wed, 1 Jul 2020 at 17:09, Guido van Rossum wrote: > &

[Python-Dev] PEP 622 version 2 (Structural Pattern Matching)

2020-07-08 Thread Guido van Rossum
. - PEP 622: https://www.python.org/dev/peps/pep-0622/ - Playground: https://mybinder.org/v2/gh/gvanrossum/patma/master?urlpath=lab/tree/playground-622.ipynb -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://femini

[Python-Dev] Re: PEP 622: Structural Pattern Matching [was: PEP 622 railroaded through?]

2020-07-07 Thread Guido van Rossum
Please move this subtopic to a subject that doesn’t have “PEP 622” in its topic. On Tue, Jul 7, 2020 at 17:54 Greg Ewing wrote: > On 8/07/20 5:30 am, Paul Sokolovsky wrote: > > from __future__ import const > > > > FOO: const = 1 > > > > match val: > > case FOO: # obviously matches by const

[Python-Dev] Re: PEP 622: Structural Pattern Matching [was: PEP 622 railroaded through?]

2020-07-07 Thread Guido van Rossum
ing with the traffic here. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> ___ Python-Dev mailing list -- python

[Python-Dev] Re: Flexible assignment targets

2020-07-02 Thread Guido van Rossum
Unfortunately there are millions of ideas. The PEP authors are taking the dilemma seriously and we are deliberating what to do. On Thu, Jul 2, 2020 at 4:04 PM Nick Coghlan wrote: > On Thu., 2 Jul. 2020, 11:18 am Guido van Rossum, wrote: > >> On Wed, Jul 1, 2020 at 5:50 PM Nick Co

[Python-Dev] Re: Flexible assignment targets

2020-07-01 Thread Guido van Rossum
ring assignment statements. > I'm not worried. Even if these didn't *exactly* the same syntax users would still benefit from similarities, e.g. `a, b, *rest = value` vs. `case a, b, *rest:`. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <h

[Python-Dev] Re: Flexible assignment targets

2020-07-01 Thread Guido van Rossum
l.python.org/archives/list/python-dev@python.org/message/IM6NZJSZHID46K3QYGG4GUJ5D6GMMX4P/ >> Code of Conduct: http://python.org/psf/codeofconduct/ >> > ___ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an

[Python-Dev] PEP 622 (match statement) playground

2020-07-01 Thread Guido van Rossum
g. For details, see https://github.com/gvanrossum/patma/tree/master/binder -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>

[Python-Dev] Re: Flexible assignment targets

2020-07-01 Thread Guido van Rossum
> > > > -- > Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia > ___ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/l

[Python-Dev] Re: Intended invariants for signals in CPython

2020-06-25 Thread Guido van Rossum
On Thu, Jun 25, 2020 at 02:02 Antoine Pitrou wrote: > ... The intent, though, is that any function > waiting on an external event (this can be a timer, a socket, a > lock, a directory...) should be interruptible so that Ctrl-C works in > an interactive prompt. > That’s not really true though rig

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
On Wed, Jun 24, 2020 at 5:30 PM Greg Ewing wrote: > On 24/06/20 11:26 am, Guido van Rossum wrote: > > A design pattern where a group of record-like classes is > > combined into a union is popular in other languages that support pattern > > matching and is known under a n

[Python-Dev] PEP 622: Structural Pattern Matching -- followup

2020-06-24 Thread Guido van Rossum
ed, e.g. '?foo' or 'foo?' to mark a variable binding and '?' for a wildcard.) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
TDI. > I guess we *could* syntactically disallow 0|_, but why bother? I don't expect anyone is going to write that and then expect the next case to be reachable. When it comes to catching unreachable code I think we have bigger fish to fry (e.g. f.close without the ()). That

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
er to see it aligned with `match` rather than with the list of cases, but for others it feels like a degenerate case and should be aligned with those. (I'm in the latter camp.) There still is a lively internal discussion going on, and we'll get back

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
That's it. No sub-classing required. > > I wondered if someday, can we do this in Python? This match-case proposal > seems to fit well in this example. > > While I know this PEP does not focus on detailed applications, > does anyone believe we can achieve elegant class cre

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
oo = foo_value := Blarg()): > > ? > The full grammar in the Appendix makes this clear -- you can't write it like that, but you could write case Spam(foo=(foo_value := Blarg()): I'll get to your other points eventually. -- --Guido van Rossum (python.org/~guido) *Pronouns:

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
On Wed, Jun 24, 2020 at 11:05 AM Brandt Bucher wrote: > Guido van Rossum wrote: > > IIUC the pattern matching uses either .get(key, ) or > .__contains__(key) followed by .__getitem__(key). Neither of those will > auto-add the item to a defaultdict (and the Mapping protocol

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
separate this out into two cases. (And yes, I can think of counterexamples, but they don't feel compelling enough to try and invent such syntax.) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-si

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
On Tue, Jun 23, 2020 at 11:27 PM Emily Bowman wrote: > I wonder if it's time to officially designate _ as a reserved name. Alas, it's too late for that. The i18n community uses _("message text") to mark translatable text. You may want to look into the gettext stdlib m

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
e multi-line lambda expression. Since Python fundamentally is not an expression language, this is no great loss -- you simply write a match statement that assigns a value to the variable in each branch. Alternatively, the match could be inside a function and each block could retur

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
bidding `_` in `**_`? > It is legal. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> ___ Python-Dev mailing list --

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
oncerns, it would be > nice to see it mentioned in the rejected alternatives section. > We can't discuss every single idea in that section. I don't think anyone else has proposed this, so I don't think it needs to be discussed for posterity. There are plenty of better ideas in

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
a natural fit). > Not a native speaker I don’t have a reasonable alternative, though. > Me neither, but I speak it quite fluently now, and 'match' really feels like it fits well here. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <h

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
On Wed, Jun 24, 2020 at 4:05 AM Greg Ewing wrote: > On 24/06/20 11:57 am, Guido van Rossum wrote: > > Matched key-value pairs must already be present in the mapping, and not > > created > > on-the-fly by ``__missing__`` or ``__getitem__``. For example, > > ``collecti

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
et), str(doc), default): > # already correct > pass > case (str(doc), default): > v = None, doc, default > > Is this correct? > Yes. Side note: I would much rather read "case str(doc) or (str(doc), )" instead > of a |. >

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Guido van Rossum
> > case Color.BLACK: > > and: > > case _.BLACK: > The PEP authors discussed this last night and (with a simple majority) we agreed that this restriction isn't all that important, so we're dropping it. https://github.com/python/peps/commit/410ba6dd484

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-23 Thread Guido van Rossum
On Tue, Jun 23, 2020 at 5:21 PM Ethan Furman wrote: > On 06/23/2020 04:26 PM, Guido van Rossum wrote: > > On Tue, Jun 23, 2020 at 11:41 AM Ethan Furman wrote: > > > > Testing my understanding -- the following snippet from the PEP > > > > match group

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-23 Thread Guido van Rossum
an have "case False:" and "case True:", should 'Ellipsis' become > a keyword so that you could have "case Ellipsis:"? Or do they have to be > "case .False:", "case .True:", in which case it could remain "case > .Ellipsis:&

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-23 Thread Guido van Rossum
must already be present in the mapping, and not created on-the-fly by ``__missing__`` or ``__getitem__``. For example, ``collections.defaultdict`` instances will only match patterns with keys that were already present when the ``match`` block was entered. You shouldn

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-23 Thread Guido van Rossum
t; @staticmethod > def __match__(obj): > # Should just return obj? > return obj.x > > match C(): > case x: > print(x) > > > But once I read on, I realized that __match__() should return `obj` in > this case. Still, the fact that return

[Python-Dev] PEP 622: Structural Pattern Matching

2020-06-23 Thread Guido van Rossum
y use named constants. These must be dotted names; a single name can be made into a constant value by prefixing it with a dot to prevent it from being interpreted as a variable extraction: ```py RED, GREEN, BLUE = 0, 1, 2 match color: case .RED: print("I see red!")

[Python-Dev] Re: Accepting PEP 618: zip(strict=True)

2020-06-18 Thread Guido van Rossum
Sure, in most places this would just look redundant, but in large corporate code bases that's exactly the kind of thing that people like to do. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-th

[Python-Dev] Re: Improving inspect capabilities for classes

2020-06-17 Thread Guido van Rossum
I presume Jupyter also lets you import code from a file, which you edit outside, Jupyter? Is,that not an option for you? On Wed, Jun 17, 2020 at 04:09 Thomas Viehmann wrote: > On 16/06/2020 20:02, Guido van Rossum wrote: > > Very few stars. This suggests not many people care about thi

[Python-Dev] Accepting PEP 618: zip(strict=True)

2020-06-16 Thread Guido van Rossum
iterator is never too short or too long. Congratulations, Brandt! -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>

[Python-Dev] Re: Should we be making so many changes in pursuit of PEP 554?

2020-06-16 Thread Guido van Rossum
tain design > tradeoffs. If I'm satisfied that subinterpreters are the correct solution > to my particular need, why shouldn't I have the privilege of doing so? > Interesting choice of word. This is open source, no feature is free, you are not entitled to anything in particular.

[Python-Dev] Re: Improving inspect capabilities for classes

2020-06-16 Thread Guido van Rossum
xamples -- but what is the real-world problem you're encountering (apparently regularly) that causes you to keep pushing on this? This needs to be explored especially since so few other people appear to need this to work. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my

[Python-Dev] Re: Should we be making so many changes in pursuit of PEP 554?

2020-06-16 Thread Guido van Rossum
once we have locks in shared memory, a crashed process leaving a lock behind may also screw up everybody else, though perhaps less severely.) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singu

[Python-Dev] Re: Improving inspect capabilities for classes

2020-06-15 Thread Guido van Rossum
via the class's `__module__` doesn't exist -- I'm sure Jupyter can arrange for that to be the case). But I see how that would be a problem (I can think of plenty of reasons why a class might not have any methods). I do think that your proposal is reasonable, although I wonder what the Jupyte

[Python-Dev] Re: How to specify optional support of arguments

2020-06-15 Thread Guido van Rossum
IMO it is up to the offending module to provide an API for advertising which variant of those functions is accepted. This seems out of scope for inspect. On Sun, Jun 14, 2020 at 23:16 Ivan Pozdeev via Python-Dev < python-dev@python.org> wrote: > > On 15.06.2020 8:45, Serhiy Storchaka wrote: > > 1

[Python-Dev] Re: Are extension types allowed to implement both nb_add and sq_concat?

2020-06-12 Thread Guido van Rossum
? Is the problem that it does the same thing as add? I'd vote for raising -- you shouldn't encourage or enable code that uses this pattern. (In general I am a big fan of just never using the operator module.) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun

[Python-Dev] Re: Are extension types allowed to implement both nb_add and sq_concat?

2020-06-12 Thread Guido van Rossum
t -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/HCXMI7LPWZEKKPRIJTVHN5ZRWIUXM5C3/ > Code of C

[Python-Dev] Re: My take on multiple interpreters (Was: Should we be making so many changes in pursuit of PEP 554?)

2020-06-09 Thread Guido van Rossum
milarly, > Py_EndInterpreter turning the lights off if it's the last one out. > ___________ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.p

[Python-Dev] Re: PEG parser and raw strings

2020-05-28 Thread Guido van Rossum
be send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/VSEB5O33WTNHBAJ63MC2WMZ772GJNMJC/ > Code of Conduct: http://python.org/psf/codeofco

[Python-Dev] Re: [python-committers] Please welcome our next Release Manager, Pablo!

2020-05-19 Thread Guido van Rossum
Huge congrats, Pablo. And thanks to Lukasz for 3.8 and 3.9. They’re all the greatest release ever! On Tue, May 19, 2020 at 15:54 Barry Warsaw wrote: > In light of the release of Python 3.9b1, let’s take a moment to celebrate > all the great work that our Python 3.8 and 3.9 release manager Łukasz

[Python-Dev] Re: PEP 584 underspecified

2020-05-19 Thread Guido van Rossum
_ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-

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

2020-05-15 Thread Guido van Rossum
On Fri, May 15, 2020 at 11:57 Henk-Jaap Wagenaar wrote: > I'll join in with the fun... > > zip(strict=True) +1 > itertools.zip_strict() +0 > zip(mode='strict') -1 > zip.strict() -1 > Those are exactly how I would vote. -- --Guido (mobile) ___ Python-

[Python-Dev] Re: Issues with import_fresh_module

2020-05-06 Thread Guido van Rossum
nsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/SDSODK5ZSJUSGDFVFOAESHYLPPFANNWD/ > Code of Conduct: http://python.org/psf/codeo

[Python-Dev] Re: PoC: Subinterpreters 4x faster than sequential execution or threads on CPU-bound workaround

2020-05-06 Thread Guido van Rossum
o have a generic implementation of "remote > object": a empty proxy object which forward all operations to a > different interpreter. It will likely be inefficient, but it may be > convenient for a start. If a method returns an object, a new proxy > should be created. Simple s

[Python-Dev] Re: PoC: Subinterpreters 4x faster than sequential execution or threads on CPU-bound workaround

2020-05-05 Thread Guido van Rossum
lti Core > Python" project: > https://github.com/ericsnowcurrently/multi-core-python/issues > > Victor > -- > Night gathers, and now my watch begins. It shall not end until my death. > ___________ > Python-Dev mailing list -- python-dev@pyth

[Python-Dev] Re: PEP 349 --- deferred but now obsolete?

2020-05-04 Thread Guido van Rossum
Agreed. On Mon, May 4, 2020 at 07:34 Victor Stinner wrote: > Hi, > > Since Python 3 "str" type already means Unicode, I understand that > Python 3 made this PEP outdated. Since Python 2 reached it's end of > life, it seems perfectly safe to reject this PEP now. > > Victor > > Le lun. 4 mai 2020

[Python-Dev] Re: Request For Review: Add support for CAN_J1939 sockets (bpo-40291)

2020-04-28 Thread Guido van Rossum
This seems to be a reasonable feature. On Tue, Apr 28, 2020 at 07:29 Karl Ding wrote: > Hi all, > > Could someone take a look at the following PR to add support for CAN_J1939 > to the socket module? I'd like to try landing this for 3.9. This > enhancement would be useful for anyone working in au

[Python-Dev] Re: Virtual machine bleeds into generator implementation?

2020-04-26 Thread Guido van Rossum
> Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-21 Thread Guido van Rossum
PM Carl Meyer wrote: > On Sat, Apr 18, 2020 at 10:38 PM Guido van Rossum > wrote: > > > > Note that, while there is indeed a docs page about 2to3, the only docs > for lib2to3 in the standard library reference are a link to the source code > and a single "Note: The

[Python-Dev] Re: Accepted PEP 615: Support for the IANA Time Zone Database in the Standard Library

2020-04-20 Thread Guido van Rossum
; https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/MDR2FL66R4T4VSLUI5XRFFUTKD43FMK4/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossu

[Python-Dev] Re: PEP 616 "String methods to remove prefixes and suffixes" accepted

2020-04-20 Thread Guido van Rossum
be send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/VV2CFGYTJXADLK5NJXECU55HS5PYNUK3/ > Code of Conduct: http://python.org/psf/codeofconduct

[Python-Dev] Re: [RELEASE] Python 2.7.18, the end of an era

2020-04-20 Thread Guido van Rossum
And thank you, Benjamin! Where's the virtual party? --Guido On Mon, Apr 20, 2020 at 08:09 Benjamin Peterson wrote: > I'm eudaemonic to announce the immediate availability of Python 2.7.18. > > Python 2.7.18 is a special release. I refer, of course, to the fact that > "2.7.18" is the closest an

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-18 Thread Guido van Rossum
to disentangle all this, and I'd be happy to help someone who wants to work on this. Finally, I should recognize the important influence of my mentor in PEG parsing, Juancarlo Añez <https://github.com/apalala/>. Without his early encouragement an

[Python-Dev] Re: Improvement to SimpleNamespace

2020-04-14 Thread Guido van Rossum
ical for JSON) is no fun with square brackets and > quotation marks. > Yeah, I get that too. So maybe this should be limited to JSON? Could the stdlib json library be made to return objects that support this (maybe with an option)? -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him

[Python-Dev] Re: Improvement to SimpleNamespace

2020-04-14 Thread Guido van Rossum
ually with the help of some schema library), but there dict notation is questionable. Accepted if you replace "users of JSON" with "users of JavaScript" -- but if you want to go there, try CoffeeScript. :-) On Tue, Apr 14, 2020 at 8:50 PM Kyle Stanley wrote: > Guido van

[Python-Dev] Re: Improvement to SimpleNamespace

2020-04-14 Thread Guido van Rossum
g list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/JOMND56PJGRN7FQQLLCWONE5Z7R2EKXW/ > Code of Conduct

[Python-Dev] Re: Providing fix for modulefinder.py regression on Windows

2020-04-11 Thread Guido van Rossum
in decode > return codecs.charmap_decode(input,self.errors,decoding_table)[0] > UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position > 308: character maps to > > Barry > ___ > Python-Dev mailing list --

[Python-Dev] Re: Need help with test_ctypes failing on Windows (test_load_dll_with_flags)

2020-04-07 Thread Guido van Rossum
_pass > > subprocess.check_output( > >File "d:\a\1\s\lib\subprocess.py", line 420, in check_output > > return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, > >File "d:\a\1\s\lib\subprocess.py", line 524, i

[Python-Dev] Re: Need help with test_ctypes failing on Windows (test_load_dll_with_flags)

2020-04-06 Thread Guido van Rossum
at further up the > output there is a FileNotFoundError for sqlite3.dll, perhaps it isn't built > or is in the wrong place? > > Ethan > > > On Mon, Apr 6, 2020, 7:19 PM Guido van Rossum wrote: > >> I have a large PR (https://github.com/python/cpython/pull/182

[Python-Dev] Need help with test_ctypes failing on Windows (test_load_dll_with_flags)

2020-04-06 Thread Guido van Rossum
ot;, line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['d:\\a\\1\\s\\PCbuild\\win32\\python.exe', '-c', "from ctypes import *; import nt;WinDLL('_sqlite3.dll', winmode=0)"]' returned non-zero exi

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-06 Thread Guido van Rossum
After 30 years am I not allowed to take new information into account and consider a change of heart? :-) On Mon, Apr 6, 2020 at 6:21 PM Steven D'Aprano wrote: > On Mon, Apr 06, 2020 at 11:54:54AM -0700, Guido van Rossum wrote: > > > (In an early version of the PEG parser,

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-06 Thread Guido van Rossum
On Mon, Apr 6, 2020 at 11:36 AM Steven D'Aprano wrote: > On Mon, Apr 06, 2020 at 10:43:11AM -0700, Guido van Rossum wrote: > > > I've been toying with the idea of introducing a "match" statement > > similar to Scala's match expression by making &qu

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-06 Thread Guido van Rossum
tion.) > Our cheaper solution is to remove the actions from the display grammar. But I don't think that Grammar/Grammar should be seen as a complete specification of the language. And I don't think it is terrible if the specification says function_def_raw: | ASYNC &#x

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-06 Thread Guido van Rossum
use of the freedom PEG gives us. (For example, I've been toying with the idea of introducing a "match" statement similar to Scala's match expression by making "match" a keyword only when followed by an expression and a colon.) -- --Guido van Rossum (python.org/~guido)

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-05 Thread Guido van Rossum
On Sun, Apr 5, 2020 at 5:16 PM Greg Ewing wrote: > On 6/04/20 4:48 am, Guido van Rossum wrote: > > There's no need to worry about this: in almost all cases the error > > indicator points to the same spot in the source code as with the old > > parser. > > I'

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-05 Thread Guido van Rossum
CVI4BGQRLN3ZRX/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-05 Thread Guido van Rossum
r points to the same spot in the source code as with the old parser. I was worried about this too, but it really doesn't seem to be a problem -- I think this might be different with highly ambiguous grammars, but since Python's grammar is still *mostly* LL(1), it looks like we're fine.

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-02 Thread Guido van Rossum
On Thu, Apr 2, 2020 at 7:55 PM Matt Billenstein wrote: > On Thu, Apr 02, 2020 at 05:17:31PM -0700, Guido van Rossum wrote: > > On Thu, Apr 2, 2020 at 4:20 PM Nathaniel Smith wrote: > > > > If the AST is supposed to be the same, then would it make sense to > >

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-02 Thread Guido van Rossum
let a language designer solve the "dangling else" problem from the Wikipedia page, by writing the form including the "else" clause first . (Python doesn't have that problem due to the use of indentation, but it might appear in another disguise.) I should probably refi

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-02 Thread Guido van Rossum
en would it make sense to > temporarily – maybe just during the alpha/beta period – always run > *both* parsers and confirm that they match? > That's not a bad idea! https://github.com/we-like-parsers/cpython/issues/33 -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-02 Thread Guido van Rossum
27;m sure there are cases where the syntax error points at a *slightly* different position -- sometimes it's a bit better, sometimes a bit worse. But there could be cases where the PEG parser reads ahead chasing some alternative that will fail much later, and then it would be much worse. W

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-02 Thread Guido van Rossum
On Thu, Apr 2, 2020 at 12:43 PM Paul Moore wrote: > On Thu, 2 Apr 2020 at 19:20, Guido van Rossum wrote: > > > > Since last fall's core sprint in London, Pablo Galindo Salgado, > Lysandros Nikolaou and myself have been working on a new parser for > CPython. We are no

[Python-Dev] Re: PEP 617: New PEG parser for CPython

2020-04-02 Thread Guido van Rossum
ay before the beta for > instance). > > Yes, sorry I don’t mean to be pedantic, but it would be better policy-wise > if the new parser were the default in time for the first beta rather than > after. > That was the intention, i.e. releasing beta 1 with the new parser being the def

[Python-Dev] PEP 617: New PEG parser for CPython

2020-04-02 Thread Guido van Rossum
emoved. 4. In Python 3.10, remove the old parser, the command-line flag, the environment variable and the "parser" module and related code. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-27 Thread Guido van Rossum
r`` subclasses, should always > return base ``str`` objects. > > Methods with the corresponding semantics will be added to the builtin > ``bytes`` and ``bytearray`` objects. If ``b`` is either a ``bytes`` > or ``bytearray`` object, then ``b.removeprefix()`` and &g

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-27 Thread Guido van Rossum
t; This could also be simplified by writing 'return self[:]'. > The two methods will also be added to ``collections.UserString``, with > similar behavior. > > My hesitation to write "return self" is resolved by saying that it should > not be relied on,

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-27 Thread Guido van Rossum
gt; To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/IO33NJUQTN27TU342NAJAAMR7YGEPQRE/ > Code of Conduct: http://python.org/psf/cod

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-22 Thread Guido van Rossum
signature of the subclass constructor. That's also why all other str methods return an instance of plain str when called on a subclass instance. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-sing

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-21 Thread Guido van Rossum
On Sat, Mar 21, 2020 at 8:38 PM Guido van Rossum wrote: > It's not great, and I actually think that "stripprefix" and "stripsuffix" are reasonable. > [explanation snipped] Thinking a bit more, I could also get behind "removeprefix" and "removesuffi

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-21 Thread Guido van Rossum
#x27;), '') > Maybe the proposed functions can optionally take a tuple of prefixes/suffixes, like startswith/endswith do? > The doubled 'e' in 'replaceend' isn't ideal, but if we went this way, I > think keeping consistency with other str method names wou

[Python-Dev] Re: Review status policy [was: PEP 585: Type Hinting Generics ...]

2020-03-14 Thread Guido van Rossum
Whoops. Here it is: https://github.com/python/steering-council/issues Tested in a private browsing window. On Sat, Mar 14, 2020 at 1:21 PM Jonathan Goble wrote: > On Sat, Mar 14, 2020 at 11:55 AM Guido van Rossum > wrote: > >> Maybe this can be done by using the public S

[Python-Dev] Re: Review status policy [was: PEP 585: Type Hinting Generics ...]

2020-03-14 Thread Guido van Rossum
Maybe this can be done by using the public SC issue tracker: https://mail.google.com/mail/u/0/#inbox/FMfcgxwHMPfZfZKJSsbVCFPXmLBQlHQd On Sat, Mar 14, 2020 at 2:01 AM Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > Guido van Rossum writes: > > > This now h

[Python-Dev] Re: PEP 585: Type Hinting Generics In Standard Collections

2020-03-13 Thread Guido van Rossum
This now happened. Maybe you can just submit it to the SC for review? Or did that already happen? (I no longer have any insight into the SC's queue.) On Tue, Feb 25, 2020 at 2:40 PM Łukasz Langa wrote: > > On 25 Feb 2020, at 16:22, Guido van Rossum wrote: > > Łukasz, do yo

[Python-Dev] Re: VS Code extension for Python.asdl

2020-03-03 Thread Guido van Rossum
; To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/ZPJN6NJPY26SZXNWS2UEM2PO34XNSKQJ/ > Code of Conduct: http://python.org/ps

[Python-Dev] Re: How to respond to repeated bad ideas

2020-03-02 Thread Guido van Rossum
> At least for python-ideas, that sounds a lot like an exhaustive list of all threads in that list. :-) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/&

[Python-Dev] How to respond to repeated bad ideas

2020-03-02 Thread Guido van Rossum
ful. Even if an idea is bad, let's respond in a friendly way, so the OP actually learns something about how Python is designed, or how it works, or whatever is relevant to understanding why their idea won't fly. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pro

[Python-Dev] Re: Accepting PEP 584: Add Union Operators To dict

2020-02-26 Thread Guido van Rossum
think that fact should be prominent in any documentation of the > new dict Union operator. > > On Wed, Feb 26, 2020, 11:06 AM Guido van Rossum wrote: > >> On Wed, Feb 26, 2020 at 7:43 AM Claudio Jolowicz >> wrote: >> >>> In my experience, the expression `value |=

[Python-Dev] Re: Hang with parallel make

2020-02-26 Thread Guido van Rossum
e send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/DGEMKEX37HEIN7MBNSBJH5P2VQVKUEI7/ > Code of Conduct: http://python.org/psf/codeofconduct/ > --

[Python-Dev] Re: Accepting PEP 584: Add Union Operators To dict

2020-02-26 Thread Guido van Rossum
e PEP 584 the most common operation is dict.update(), which has the same semantics.) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> _

[Python-Dev] Re: PEP 585: Type Hinting Generics In Standard Collections

2020-02-25 Thread Guido van Rossum
ing and enforcement (e.g. having > instances throw TypeError if you tried to insert a value of the wrong > type). > > Cheers, > Nick. > > -- > Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **

<    1   2   3   4   5   6   7   8   9   10   >