Re: [Python-ideas] PEP 572: about the operator precedence of :=

2018-05-10 Thread Guido van Rossum
end I think they should be called "assignment expressions" just like in C. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] PEP 572: about the operator precedence of :=

2018-05-10 Thread Guido van Rossum
On Thu, May 10, 2018 at 3:32 AM, Terry Reedy wrote: > On 5/9/2018 11:33 PM, Guido van Rossum wrote: > > I now think that the best way out is to rule `:=` in the top level >> expression of an expression statement completely >> > > I would like to be able to interactive

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-10 Thread Guido van Rossum
an attempting to restrict the construct purely to > if/elif/while. > > Even as a generally available postfix keyword, "given" should still be > amenable to the treatment where it could be allowed as a variable name in a > non-operator contex

Re: [Python-ideas] A comprehension scope issue in PEP 572

2018-05-10 Thread Guido van Rossum
On Thu, May 10, 2018 at 5:17 AM, Nick Coghlan wrote: > On 9 May 2018 at 03:06, Guido van Rossum wrote: > >> So the way I envision it is that *in the absence of a nonlocal or global >> declaration in the containing scope*, := inside a comprehension or genexpr >> causes t

Re: [Python-ideas] PEP 572: about the operator precedence of :=

2018-05-09 Thread Guido van Rossum
On Wed, May 9, 2018 at 8:42 PM, Chris Angelico wrote: > On Thu, May 10, 2018 at 1:33 PM, Guido van Rossum > wrote: > > (I vaguely recall this has been brought up before, but I'm too lazy to > find > > the subtread. So it goes.) > > > > PEP 572 curren

[Python-ideas] PEP 572: about the operator precedence of :=

2018-05-09 Thread Guido van Rossum
ver having to deal with ambiguities like `a, a+1 for a in range(10)` or `a for a in x, y`.) Another alternative would be to always require parentheses around `:=`, so that we would have to write `f((a := 1), 1)`. That's unambiguous, but otherwise just gets on the nerves. -- --Guido van Rossum

Re: [Python-ideas] A comprehension scope issue in PEP 572

2018-05-08 Thread Guido van Rossum
eating a second p in the containing scope -- either way it's probably a typo anyway. := outside a comprehension/genexpr is treated just like any other assignment (other than in-place assignment), i.e. it creates a local unless a nonlocal or global declaration exists. -- --Guido van

Re: [Python-ideas] Runtime assertion with no overhead when not active

2018-05-08 Thread Guido van Rossum
On Tue, May 8, 2018 at 12:29 AM, Eloi Gaudry wrote: > On Mon, 2018-05-07 at 10:52 -0700, Guido van Rossum wrote: > > On Mon, May 7, 2018 at 6:24 AM, Serhiy Storchaka > > wrote: > > > I just don't understand why you need a new keyword for writing > > > run

Re: [Python-ideas] Runtime assertion with no overhead when not active

2018-05-07 Thread Guido van Rossum
s off he doesn't want to incur the overhead of evaluating the check. The assert statement has the latter property, but you have to use -O to turn it off. He basically wants a macro so that runtime_assert() expands to if and (): raise AssertionError In Lisp this would be easy

Re: [Python-ideas] A comprehension scope issue in PEP 572

2018-05-07 Thread Guido van Rossum
S3. Comprehensions and generator expressions should be interchangeable. They just look too similar to have different semantics (and the possibly delayed execution of generator expressions is not an issue -- it's rare, and closure semantics make it work just fine). -- --Guido van Rossu

Re: [Python-ideas] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2018-05-05 Thread Guido van Rossum
ectly clear to me what you are proposing) but for real-world code that would benefit from this addition to the itemgetter API. --Guido On Wed, May 2, 2018 at 1:08 AM, Vincent Maillol wrote: > Hi everybody, > > Our PEP idea would be to purpose to add a global default value for > itemge

Re: [Python-ideas] Auto-wrapping coroutines into Tasks

2018-05-04 Thread Guido van Rossum
. But there would > be some costs here; the trade-off would be a significant > simplification and increase in usability, because regular users could > simply stop having to know about 'coroutine objects' and 'awaitables' > and all that entirely, and we'd be able to take more advantage of > async/await in existing libraries. > > What do you think? > > -n > > [1] https://mail.python.org/pipermail/async-sig/2018-May/000484.html > [2] https://mail.python.org/pipermail/async-sig/2018-April/000470.html > > -- > Nathaniel J. Smith -- https://vorpus.org > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-04 Thread Guido van Rossum
ge in Python's > >>> life, adding new _reserved_ words "should be" an extremely high bar - > >>> but adding new non-reserved keywords (like "async") should be a much > >>> lower bar. > > > > [Guido] > >> Do note that thi

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-04 Thread Guido van Rossum
; shouldn't be exaggerated. Currently you can search for "python operators" and get tons of sites that list all operators. I also note that Google seems to be getting smarter about non-alphabetic searches -- I just searched for "python << operator" and the first hit

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-04 Thread Guido van Rossum
h runs into a different > set of problems related to trying to use "with" for two distinct and > entirely unrelated purposes). > > Cheers, > Nick. > > -- > Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia > > ___

Re: [Python-ideas] Pattern Matching Syntax

2018-05-04 Thread Guido van Rossum
s. If I've learned one thing from PEP 572 it's that we need to adjust how we discuss and evaluate proposals. I'll think about this and start a discussion at the Language Summit about this. -- --Guido van Rossum (python.org/~guido) ___

Re: [Python-ideas] Change magic strings to enums

2018-04-25 Thread Guido van Rossum
On Wed, Apr 25, 2018, 02:13 Jacco van Dorp wrote: > ... Which is where the auto-completion comes in. ... > Designing the language with auto-complete in mind feels wrong to me. It assumes a very sophisticated IDE and may lead to lazy design compromises. -

Re: [Python-ideas] Change magic strings to enums

2018-04-25 Thread Guido van Rossum
o, the stdlib should not depend on Cython, no matter how great. That would be a terrible dependency cycle. --Guido > ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Checking interned string after stringobjects concat?

2018-04-21 Thread Guido van Rossum
But to the OP, this is not considered a bug. On Sat, Apr 21, 2018, 07:59 Serhiy Storchaka wrote: > 21.04.18 17:47, Chris Angelico пише: > > On Sat, Apr 21, 2018 at 10:29 PM, Serhiy Storchaka > wrote: > >> 21.04.18 13:42, Chris Angelico пише: > >>> > >>> What you're seeing there is actually the

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

2018-04-16 Thread Guido van Rossum
; `target ? expr` could mean `expr if target else target`. Other proposal for > null/boolean checking might need `?`, let's preserve `?` character for > further development. > The only acceptable use of ? is formulated in PEP 505. -- --Guido van Rossum (python.org/~guido) __

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

2018-04-15 Thread Guido van Rossum
reason I strongly prefer := as inline assignment operator. > But somehow this PEP does not mean it! And with the current rationale of > this PEP it's a huge CON for me that `=` and `:=` feel and look the same. > Then maybe the PEP needs to be update

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

2018-04-13 Thread Guido van Rossum
bove where I'd pronounce it as "into") > > The connection with function declarations would be a little tenuous, > but could be rationalised as: > > Given the function declation: > > def f(...) -> Annotation: > ... > > Then in the named subexpre

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

2018-04-13 Thread Guido van Rossum
nd you can use assignment in expressions too, except there you must use := because = would be too easily confused with ==". Ideally this would allow all forms of = to be replaced with :=, even extended structure unpacking (a, b, *c := foo()). -- --Guido van Rossum (py

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

2018-04-12 Thread Guido van Rossum
if (x ;= i) + 1: >> >> On the third hand, requiring parentheses all the time would also feel >> strained: >> >> while m := someregexp.match(somestring): >> >> is already impossible to misread. >> >> Annoying ;-) >> > > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > > -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

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

2018-04-12 Thread Guido van Rossum
:= function() is None else var.method() > > Still not bad looking. > Though a long way from function()?.method() per PEP 505. :-) -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.pytho

Re: [Python-ideas] Accepting multiple mappings as positional arguments to create dicts

2018-04-12 Thread Guido van Rossum
tract class breaks an interface. > > We will be able to pass this path (we have already passed it), but we must > realize how long it is. > > > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/m

Re: [Python-ideas] Default values in multi-target assignment

2018-04-12 Thread Guido van Rossum
)(*c) > > _______ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Accepting multiple mappings as positional arguments to create dicts

2018-04-12 Thread Guido van Rossum
read and grep. > > It allows for creating a flattened dict from an iterable of dicts, too, > which I've occasionally wanted: > > >>> configs = {'a': 'yes'}, {'b': 'no'}, {'c': 3} > >>> dict(*configs) > {'a

Re: [Python-ideas] Is there any idea about dictionary destructing?

2018-04-10 Thread Guido van Rossum
ht have a different view on that. You should probably use some kind of schema-guided parser though.) -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Start argument for itertools.accumulate() [Was: Proposal: A Reduce-Map Comprehension and a "last" builtin]

2018-04-10 Thread Guido van Rossum
he average (getting the trend for free) - to emphasize the sum, draw a histogram -- in my mind I add up the sizes of the bars -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.or

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-04-08 Thread Guido van Rossum
and because it would create an ugly discontinuity between (a := f()) and (a := f(),). But then switching between [a := f(), a] and (a := f(), a) would create a discontinuity. For comprehensions and generator expressions there is no such discontinuity in the new proposal, since these *already* int

Re: [Python-ideas] Start argument for itertools.accumulate() [Was: Proposal: A Reduce-Map Comprehension and a "last" builtin]

2018-04-08 Thread Guido van Rossum
:19 AM, Nick Coghlan wrote: > > On 8 April 2018 at 14:31, Guido van Rossum wrote: > >> Given that two respected members of the community so strongly disagree > >> whether accumulate([], start=0) should behave like accumulate([]) or > like > >> accumulate([

Re: [Python-ideas] Start argument for itertools.accumulate() [Was: Proposal: A Reduce-Map Comprehension and a "last" builtin]

2018-04-07 Thread Guido van Rossum
ng the default value of > "start" much easier to document (since it would just be zero, the same > as it is for sum()), and only the length of the input iterable and > "yield_start" would affect how many partial sums were produced. > > Cheers, > Nick. &g

Re: [Python-ideas] Proposal: A Reduce-Map Comprehension and a "last" builtin

2018-04-06 Thread Guido van Rossum
gt; This would allow updating variables in a generator (I don't see the need > for ":=" or "f() as a") but that's another discussion > Please join the PEP 572 discussion. The strongest contender currently is `a := f()` and for good reasons. -- --Guid

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-04-02 Thread Guido van Rossum
> close to perfect in ease of learning/comprehension as it gets, from someone > who studied math before C anyway. > > -Mike > > > > On 2018-03-30 12:04, Nikolaus Rath wrote: > ___ > Python-ideas mailing list > Python-ideas@p

Re: [Python-ideas] PEP draft: Unifying function/method classes

2018-04-02 Thread Guido van Rossum
mments first. > > > Thanks, > Jeroen. > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~g

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-03-30 Thread Guido van Rossum
On Fri, Mar 30, 2018 at 12:04 PM, Nikolaus Rath wrote: > On Mar 25 2018, Guido van Rossum public.gmane.org> wrote: > > I gotta say I'm warming up to := in preference over 'as', *if* we're > going > > to do this at all (not a foregone conclusion a

Re: [Python-ideas] threading lock and isinstance

2018-03-29 Thread Guido van Rossum
___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido)

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-03-27 Thread Guido van Rossum
This thread is dead. On Tue, Mar 27, 2018 at 5:40 PM, Rob Cliffe via Python-ideas < python-ideas@python.org> wrote: > > > On 28/03/2018 01:19, Steven D'Aprano wrote: > >> On Wed, Mar 28, 2018 at 12:08:24AM +0100, Rob Cliffe via Python-ideas >> wrote: >>

Re: [Python-ideas] Fixing class scope brainstorm

2018-03-27 Thread Guido van Rossum
On Tue, Mar 27, 2018 at 11:51 AM, Ivan Levkivskyi wrote: > On 27 March 2018 at 19:43, Ethan Furman wrote: > >> On 03/27/2018 11:12 AM, Ivan Levkivskyi wrote: >> >>> On 27 March 2018 at 18:19, Guido van Rossum wrote: >>> >> >> Hm, so maybe we sho

Re: [Python-ideas] Fixing class scope brainstorm

2018-03-27 Thread Guido van Rossum
On Tue, Mar 27, 2018 at 11:43 AM, Ethan Furman wrote: > On 03/27/2018 11:12 AM, Ivan Levkivskyi wrote: > >> On 27 March 2018 at 18:19, Guido van Rossum wrote: >> > > Hm, so maybe we shouldn't touch lambda, but we can at least fix the scope >>>

Re: [Python-ideas] Fixing class scope brainstorm

2018-03-27 Thread Guido van Rossum
level comprehension references x assuming it to be the global. So we need to tread carefully even here -- but this case is weird already: x = 42 class C: x = [1, 2, 3] z = [x+y for y in x] # [43, 44, 45] -- --Guido van Rossum (python.org/~guido) _

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-03-27 Thread Guido van Rossum
On Tue, Mar 27, 2018 at 7:00 AM, Nick Coghlan wrote: > On 27 March 2018 at 01:57, Guido van Rossum wrote: > > On Mon, Mar 26, 2018 at 7:57 AM, Nick Coghlan > wrote: > >> By contrast, the sublocals idea strives to keep the *lifecycle* impact > >> of naming a

Re: [Python-ideas] Fixing class scope brainstorm

2018-03-26 Thread Guido van Rossum
On Mon, Mar 26, 2018 at 6:33 AM, Nick Coghlan wrote: > On 26 March 2018 at 01:50, Guido van Rossum wrote: > > In the PEP 572 threads there's some grumbling about class scopes. > > > > Here's a random brainstorm. How about we change the scoping rules so that >

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-03-26 Thread Guido van Rossum
On Mon, Mar 26, 2018 at 7:57 AM, Nick Coghlan wrote: > On 26 March 2018 at 14:34, Guido van Rossum wrote: > > Not so fast. There's a perfectly reasonable alternative to sublocal > scopes > > -- just let it assign to a local variable in the containing scope. That's

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-03-25 Thread Guido van Rossum
On Sun, Mar 25, 2018 at 6:29 PM, Chris Angelico wrote: > On Mon, Mar 26, 2018 at 12:24 PM, Guido van Rossum > wrote: > > The scope question is far from easy though. I find it particularly > grating > > that an inline assignment occurs in an 'if' statement, its

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-03-25 Thread Guido van Rossum
the normal comparison operator > > is ===. It's *still* not uncommon to see a comparison spelled =. > > I wonder whether Guido remembers this ;-) In the very, very, VERY > early days, Python didn't have "==". Plain single "=" was used for > both as

[Python-ideas] Fixing class scope brainstorm

2018-03-25 Thread Guido van Rossum
pe as an outer scope so they can close over class variables? Not sure what should happen to nested classes, they should probably be lumped in with the 'def' scopes. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-03-25 Thread Guido van Rossum
change, > too - instead of creating a function, they just create a sublocal > scope. > > That may be the best way forward. I'm not sure. > > ChrisA > I don't think the PEP should be split up into two PEPs. The two topics are too closely related. But you can have sep

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-03-24 Thread Guido van Rossum
pat.match(text)) and check((g = m.group(0))): print(g) or if (pat.match(text) as m) and check((m.group(0) as g)): print(g) -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] PEP 572 version 2: Statement-Local Name Bindings

2018-03-24 Thread Guido van Rossum
28 years ago it was the best we could do, and by the time we realized its problems -- all rare edge cases for sure, but unintuitive and hard to debug when they strike -- we were tied by backward compatibility. And we still are. (At the time there

Re: [Python-ideas] PEP 572 version 2: Statement-Local Name Bindings

2018-03-23 Thread Guido van Rossum
thon 6. It would certainly suit a language that is widely used in > education to sharpen the distinction between assignment and equality > operators. > > Cheers, > Christoph > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/m

Re: [Python-ideas] Adding quantile to the statistics module

2018-03-17 Thread Guido van Rossum
ut unfortunately you're not going to find TOOWTDI. > > -n > > -- > Nathaniel J. Smith -- https://vorpus.org > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-

Re: [Python-ideas] Disallow importing the same module under multiple names

2018-03-14 Thread Guido van Rossum
> Brendan Barnwell > "Do not follow where the path may lead. Go, instead, where there is no > path, and leave a trail." >--author unknown > > ___ > Python-ideas mailing list > Python

Re: [Python-ideas] Descouraging the implicit string concatenation

2018-03-14 Thread Guido van Rossum
I use the feature regularly for long error messages, and when combined with .format() or % it's not so easy to replace it with a + (it would require adding parentheses). So I am against formally discouraging it or adding something to PEP 8. However linters could warn about lists of comma-separate

Re: [Python-ideas] Add MutableSet.update?

2018-03-09 Thread Guido van Rossum
on.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > > -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-03-01 Thread Guido van Rossum
d to a mail/news client. > We can kill this topic right now. We'll be moving to MM3, which is a mailing list for those who like email, and can also be used as a web forum for those who like that. Personally I'm partial to both, so I think this is the best of both worlds. -- --Guido va

Re: [Python-ideas] Medium for discussion potential changes to python (was: PEP 572: Statement-Local Name Bindings)

2018-03-01 Thread Guido van Rossum
ling list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] List assignment - extended slicing inconsistency

2018-02-22 Thread Guido van Rossum
code that currently doesn't raise will break, right? > Summary > === > I find it it not acceptable as a good language design that there is a > large range of behaviour on slicing in assignment target for the different > native (and standard library) data type of seemingly similar kind, and that > users have to figure out for each data type by testing - or at the very > least remember if documented - how it behaves on slicing in assignment > targets. There should be a consistent behaviour at the very least, ideally > even one with a clear user interface as suggested for lists. > Fortunately, what *you* find acceptable or good language design is not all that important. (You can avoid making any mistakes in your own language. :-) You may by now realize that 100% consistent behavior is hard to obtain. However we'll gladly consider your feedback. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Why CPython is still behind in performance for some widely used patterns ?

2018-02-20 Thread Guido van Rossum
On Tue, Feb 20, 2018 at 12:54 PM, Barnstone Worthy wrote: I'm pretty sure that's an alias for Barry Warsaw. :-) -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailma

Re: [Python-ideas] Boolean ABC similar to what's provided in the 'numbers' module

2018-02-20 Thread Guido van Rossum
Integral as an alias for backwards compatibility. I don't think it's a huge problem to fix this in 3.7b2, if someone wants to do the work. On Mon, Feb 19, 2018 at 9:53 PM, Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > Guido van Rossum writes: > > > Hm, p

Re: [Python-ideas] Boolean ABC similar to what's provided in the 'numbers' module

2018-02-19 Thread Guido van Rossum
ke Boolean? Though it's also possible that it was simply a mistake. In general I don't like adding aliases for different spellings -- it violates TOOWTDI. If we decide that this really was a mistake we should go ahead and make Integer the recommended way and define Integral as an alias for ba

[Python-ideas] PEP 468

2018-02-18 Thread guido
Gesendet von Mail für Windows 10 ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

[Python-ideas] (no subject)

2018-02-18 Thread guido
___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Boolean ABC similar to what's provided in the 'numbers' module

2018-02-15 Thread Guido van Rossum
a numpy bool. But maybe > that’s too much of type checking for the python philosophy ? I’m wondering > if we’re going too far here… > > > > Anyway, again, my point is just about consistency: if this is available > for numbers, why not for simple Booleans? > > > >

Re: [Python-ideas] Boolean ABC similar to what's provided in the 'numbers' module

2018-02-14 Thread Guido van Rossum
types, not to switch to numbers.Integral. And the reason is that few people (outside hardcore np fans) will want to write numbers.Integral instead of int. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org http

Re: [Python-ideas] Boolean ABC similar to what's provided in the 'numbers' module

2018-02-14 Thread Guido van Rossum
re not dependent on MyPy. > > > > Sylvain > > > > *De :* gvanros...@gmail.com [mailto:gvanros...@gmail.com] *De la part de* > Guido van Rossum > *Envoyé :* mercredi 14 février 2018 19:47 > *À :* Sylvain MARIE > > *Cc :* python-ideas > *Objet :* Re: [Python-i

Re: [Python-ideas] Boolean ABC similar to what's provided in the 'numbers' module

2018-02-14 Thread Guido van Rossum
schneider- > electric@python.org] *De la part de* David Mertz > *Envoyé :* mardi 13 février 2018 07:08 > *À :* Nick Coghlan > *Cc :* python-ideas > *Objet :* Re: [Python-ideas] Boolean ABC similar to what's provided in > the 'numbers' module > > > >

Re: [Python-ideas] Boolean ABC similar to what's provided in the 'numbers' module

2018-02-14 Thread Guido van Rossum
Can you show some sample code that you have written that shows where this would be useful? Note that using the numbers package actually makes static type checking through e.g. mypy difficult. So I presume you are talking about dynamic checking? --Guido On Feb 14, 2018 12:42 AM, "Sylvain

Re: [Python-ideas] Boolean ABC similar to what's provided in the 'numbers' module

2018-02-12 Thread Guido van Rossum
> > """~self""" > > > > > > # register bool and numpy bool_ as virtual subclasses > > # so that issubclass(bool, Boolean) = issubclass(np.bool_, Boolean) = True > > Boolean.register(bool) > > > > try: > > import numpy as np > > Boolean.register(n

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-31 Thread Guido van Rossum
OK, I am no longer interested in this topic. If you can't reach agreement, so be it, and then the status quo prevails. I am going to mute this thread. There's no need to explain to me why I am wrong. On Wed, Jan 31, 2018 at 9:48 AM, Serhiy Storchaka wrote: > 31.01.18 18:36, Gui

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-31 Thread Guido van Rossum
On Wed, Jan 31, 2018 at 3:03 AM, Serhiy Storchaka wrote: > 19.01.18 05:51, Guido van Rossum пише: > >> Can someone explain to me why this is such a controversial issue? >> >> It seems reasonable to me to add new encodings to the stdlib that do the >> roundtripping

Re: [Python-ideas] Adding str.isascii() ?

2018-01-31 Thread Guido van Rossum
> it more), but since it is added I don't see much benefit from removing it. > > > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Dataclasses, keyword args, and inheritance

2018-01-29 Thread Guido van Rossum
t;there's no reason to try to implement this." > > On Mon, Jan 29, 2018 at 11:05 AM Guido van Rossum > wrote: > >> I think that settles it -- there's no reason to try to implement this. >> >> On Mon, Jan 29, 2018 at 10:51 AM, George Leslie-Waksman <

Re: [Python-ideas] Dataclasses, keyword args, and inheritance

2018-01-29 Thread Guido van Rossum
efault value or factory. Attribute in question: Attribute(name='b', > default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, > metadata=mappingproxy({}), type=None, converter=None) > > > On Fri, Jan 26, 2018 at 1:44 PM Guido van Rossum wrote: >

Re: [Python-ideas] Adding str.isascii() ?

2018-01-26 Thread Guido van Rossum
xisting internal flag is an implementation detail that should not show in the API. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Adding str.isascii() ?

2018-01-26 Thread Guido van Rossum
gt; Steve > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) ___

Re: [Python-ideas] Dataclasses, keyword args, and inheritance

2018-01-26 Thread Guido van Rossum
>> > I understand that this is a limitation of positional arguments >> > because the effective __init__ signature is: >> > >> > def __init__(self, some_default: dict = , >> > other_field: int): >> > >&

Re: [Python-ideas] .then execution of actions following a future's completion

2018-01-26 Thread Guido van Rossum
can use them for this” example was provided. > > -dancollins34 > > Sent from my iPhone > > On Jan 26, 2018, at 1:05 PM, Guido van Rossum wrote: > > On Fri, Jan 26, 2018 at 9:20 AM, Daniel Collins > wrote: > >> @Guido As an aside, my understanding was librari

Re: [Python-ideas] .then execution of actions following a future's completion

2018-01-26 Thread Guido van Rossum
On Fri, Jan 26, 2018 at 9:20 AM, Daniel Collins wrote: > @Guido As an aside, my understanding was libraries that fall back to c > (Numpy as an example) release the GIL for load heavy operations. But I > believe the explanation would hold in the general case if you replace > thread

Re: [Python-ideas] .then execution of actions following a future's completion

2018-01-26 Thread Guido van Rossum
) for each b operation. Then you could > call this like > > b_fut = a_fut.then(b) > > for i in range(3): > b_fut.then(c) > > And the execution would look like this: > > ExecutorThread: > Worker1: a*5 b*5 c*15 > Worker2: a*5 b*5 c*15 > > Which would be

Re: [Python-ideas] Adding str.isascii() ?

2018-01-26 Thread Guido van Rossum
; ref: https://github.com/python/cpython/blob/e76daebc0c8afa3981a4c5a8b54537 > f756e805de/Lib/ipaddress.py#L491-L494 > > If str has str.isascii() method, it can be simpler: > > `if s.isascii() and s.isdigit():` > > I want to add it in Python 3.7 if there are no opposite opinions. &g

Re: [Python-ideas] .then execution of actions following a future's completion

2018-01-25 Thread Guido van Rossum
.Future. > Thoughts? > > -dancollins34 > > Github PR #5335 > bugs.python.org issue #32672 > > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: htt

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-21 Thread Guido van Rossum
On Sun, Jan 21, 2018 at 2:43 AM, Steven D'Aprano wrote: > On Fri, Jan 19, 2018 at 06:35:30PM +, Rob Speer wrote: > > Guido had some very sensible feedback just a moment ago. I am wondering > now > > if we lost Guido because I broke python-ideas etiquette (is a pull >

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-19 Thread Guido van Rossum
nts these mappings as > new encodings that work just like the other ones. > > On Fri, 19 Jan 2018 at 11:54 M.-A. Lemburg wrote: > >> On 19.01.2018 17:20, Guido van Rossum wrote: >> > On Fri, Jan 19, 2018 at 5:30 AM, M.-A. Lemburg > > <mailto:m...@egenix.com>> wrote

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Guido van Rossum
would hide the site-packages/test directory. -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-19 Thread Guido van Rossum
On Fri, Jan 19, 2018 at 5:30 AM, M.-A. Lemburg wrote: > On 19.01.2018 05:38, Nathaniel Smith wrote: > > On Thu, Jan 18, 2018 at 7:51 PM, Guido van Rossum > wrote: > >> Can someone explain to me why this is such a controversial issue? > > > > I guess pra

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Guido van Rossum
@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

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

2018-01-18 Thread Guido van Rossum
ion for (b), getting past (a) isn't so easy. So don't get nerd-sniped by the solution for (b) alone.) -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-18 Thread Guido van Rossum
(Modifying existing encodings seems wrong -- did the feature request somehow transmogrify into that?) -- --Guido van Rossum (python.org/~guido) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code

Re: [Python-ideas] Make functions, methods and descriptor types living in the types module

2018-01-12 Thread Guido van Rossum
e > builtins namespace? > That would violate the very definition of the builtins module. PS. There are probably many more of these. E.g. NoneType, dict_keys, etc. --Guido On 12Jan2018 0941, Victor Stinner wrote: > >> I like the idea of having a fully qualified name that "w

Re: [Python-ideas] pdb to support running modules

2018-01-04 Thread Guido van Rossum
Code of Conduct: http://python.org/psf/codeofconduct/ >> > > > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2018-01-03 Thread Guido van Rossum
On Wed, Jan 3, 2018 at 8:24 AM, Random832 wrote: > On Sun, Dec 31, 2017, at 00:33, Guido van Rossum wrote: > > I'm not keen on this recommendation. An argument that takes a Set[Foo] > > would mean that in order to specify: > > - no flags: you'd have to pass set() -

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2018-01-01 Thread Guido van Rossum
__ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) __

Re: [Python-ideas] Improve ABCs _dump_registry() readability

2017-12-31 Thread Guido van Rossum
s for this). > > > >In the C version the caches/registry will be simpler and will not use > WeakSet (instead they will be thin C wrappers around normal sets). > > Ok, no problem. > > Found out myself why the registry's empty: > every iterator passed to Iterator.register(

Re: [Python-ideas] Improve ABCs _dump_registry() readability

2017-12-31 Thread Guido van Rossum
ors in the cache should've been in the registry instead, should'nt > they? > _______ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/ps

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-30 Thread Guido van Rossum
rd example). When using IntFlag, you just use 0. On Sat, Dec 30, 2017 at 9:33 PM, Guido van Rossum wrote: > On Sat, Dec 30, 2017 at 8:50 PM, Franklin? Lee < > leewangzhong+pyt...@gmail.com> wrote: >> >> Paddy might want something like this: >> - For existing APIs whi

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-30 Thread Guido van Rossum
#x27;d have to pass set() -- you can't use {} since that's an empty dict, not an empty set - one flag: you'd have to pass {Foo.BAR} rather than just Foo.BAR - two flags: you'd have to pass {Foo.BAR, Foo.BAZ} rather than Foo.BAR | Foo.BAZ I think for each of these the proposal would b

Re: [Python-ideas] Change the __repr__ of the `MappingView`s

2017-12-30 Thread Guido van Rossum
elements = ', '.join(map(repr, self)) > File "/usr/lib/python3.6/_collections_abc.py", line 764, in __iter__ > yield self._mapping[key] > TypeError: list indices must be integers or slices, not str > > > It's because __init__ in MappingView treat the passed argument -- wich is >

Re: [Python-ideas] Make MappingView inherit from Collection instead of Sized

2017-12-29 Thread Guido van Rossum
This sounds like a good observation. I recommend opening a bug and preparing a PR if you can (a PR would also help finding if there are any problems with the idea). On Dec 29, 2017 9:50 AM, "Yahya Abou 'Imran via Python-ideas" < python-ideas@python.org> wrote: > After I generate an UML diagram fr

<    2   3   4   5   6   7   8   9   10   >