[Python-ideas] Re: f-string: empty expression should be allowed

2020-10-23 Thread Guido van Rossum
been worked on at the Core dev sprint that's currently winding down. But the quoting won't change. -- --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-c

[Python-ideas] Re: Extrapolating PEP 634: The walrus was waiting for patmat all along

2020-10-23 Thread Guido van Rossum
t; To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/MJ7JHYKHKB2T4SCFV4TX4IMKUANUAF5B/ > Code of Conduct: http://p

[Python-ideas] Re: Dict unpacking assignment

2020-10-25 Thread Guido van Rossum
deas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/H5252OAGH2IWEVQ26F2OWNQZC

[Python-ideas] Re: Dict unpacking assignment

2020-10-22 Thread Guido van Rossum
kwargs inside functions and methods: > > > def method(self, **kwargs): > spam, eggs, **kw = **kwargs > process(spam, eggs) > super().method(**kw) > > > -- > Steve > ___ >

[Python-ideas] Re: PEP 472 -- Support for indexing with keyword arguments

2020-07-18 Thread Guido van Rossum
On Sat, Jul 18, 2020 at 9:11 PM Christopher Barker wrote: > > > On Sat, Jul 18, 2020 at 1:43 PM Guido van Rossum wrote: > >> Yes please. >> > > Yes to what, exactly? > > -CHB > > FWIW, IIRC the “bundle values in a single parameter” predates the demise

[Python-ideas] Re: PEP 472 -- Support for indexing with keyword arguments

2020-07-18 Thread Guido van Rossum
Yes please. FWIW, IIRC the “bundle values in a single parameter” predates the demise of __getslice__. It probably was meant for dict keys primarily (no surprise there). The bundling would have been easier for the C API — __getitem__ is as old as Python there. On Sat, Jul 18, 2020 at 10:49 Steven

[Python-ideas] Re: Experimenting with dict performance, and an immutable dict

2020-07-21 Thread Guido van Rossum
That seems pretty clear — presumably it follows the lead of frozenset and tuple. On Tue, Jul 21, 2020 at 21:45 Todd wrote: > What, exactly, is frozen? My understanding is that one problem with > frozen dicts in the past is deciding exactly what is mutable and what is > immutable. Can you

[Python-ideas] Re: add !p to pprint.pformat() in str.format() an f-strings

2020-07-21 Thread Guido van Rossum
A philosophical problem with this is proposal is that it takes a notation that is processed by the bytecode compiler and makes it dependent on user code to be imported from the stdlib. We only do that in rare cases — IIRC the only other case is ‘import’ calling ‘__import__()’. This reversal of

[Python-ideas] Re: Package kwkey and PEP 472 -- Support for indexing with keyword arguments

2020-08-03 Thread Guido van Rossum
ill talking > about implementing this using a new class. However, most people who > support the use of labelled indexing.and expressed an opinion support a > keyword argument-based approach. > ___ > Python-ideas mailing list -- python-i

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-08-01 Thread Guido van Rossum
: > On Fri, Jul 31, 2020 at 7:34 AM Guido van Rossum wrote: > >> So maybe we need to add dict.ordered() which returns a view on the items >> that is a Sequence rather than a set? Or ordereditems(), orderedkeys() and >> orderedvalues()? >> > > I'm still

[Python-ideas] Re: Package kwkey and PEP 472 -- Support for indexing with keyword arguments

2020-08-03 Thread Guido van Rossum
On Mon, Aug 3, 2020 at 2:35 PM Todd wrote: > On Mon, Aug 3, 2020, 17:13 Guido van Rossum wrote: > >> On Mon, Aug 3, 2020 at 1:49 PM Christopher Barker >> wrote: >> >>> >>> Yes, that would be correct. However, the function could instead be >>>

[Python-ideas] Re: Package kwkey and PEP 472 -- Support for indexing with keyword arguments

2020-08-03 Thread Guido van Rossum
class C: def __getitem__(self, index): ... c = C() then presumably calling `c[1, index=2]` would just be an error (since it would be like attempting to call the method with two values for the `index` argument), and ditto for `c[1, 2, 3, index=4]`. The only odd case might be `c[index=

[Python-ideas] Re: Introduce a boundary parameter for typing.get_type_hints when used with a class object

2020-08-04 Thread Guido van Rossum
Maybe get-type-hints can be refactored to make writing such a function simpler. IIRC the part that takes a single annotation and evaluates it is a private function. On Tue, Aug 4, 2020 at 12:57 David Mertz wrote: > This definitely feels to me like though if an oddball case that "write > your

[Python-ideas] Re: Decorators for class non function properties

2020-08-05 Thread Guido van Rossum
On Wed, Aug 5, 2020 at 6:42 PM Steven D'Aprano wrote: > On Wed, Aug 05, 2020 at 06:15:22PM -0700, Guido van Rossum wrote: > > On Wed, Aug 5, 2020 at 5:55 PM Steven D'Aprano > wrote: > > > > That require two different rules for decorators: > > > > > > @

[Python-ideas] Re: Decorators for class non function properties

2020-08-05 Thread Guido van Rossum
is includes making up your own dunders), which means that technically the implementation could do whatever it wants -- but since this is Python we probably want to accept that it's called for every attribute, whether it smells like a descriptor or not, and it would be nice to fix the docs.

[Python-ideas] Re: Inline Try-Except Clause

2020-08-07 Thread Guido van Rossum
ted. > Alas, it hasn't. Language design is not an exact science, and my gut still tells me that inline exceptions are a bad idea. -- --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-ca

[Python-ideas] Re: Package kwkey and PEP 472 -- Support for indexing with keyword arguments

2020-08-07 Thread Guido van Rossum
On Fri, Aug 7, 2020 at 6:02 PM Greg Ewing wrote: > On 4/08/20 9:12 am, Guido van Rossum wrote: > > then presumably calling `c[1, index=2]` would just be an error (since it > > would be like attempting to call the method with two values for the > > `index` argument), >

[Python-ideas] Re: Inline Try-Except Clause

2020-08-07 Thread Guido van Rossum
On Fri, Aug 7, 2020 at 10:44 AM Rob Cliffe wrote: > > On 07/08/2020 16:58, Guido van Rossum wrote: > > On Fri, Aug 7, 2020 at 8:15 AM David Mertz wrote: > >> I think getting Guido on board would be a huge step. Python has added >> quite a bit of new syntax si

[Python-ideas] Re: use type hints and slices to specify a valid numerical range, example: `Angle = int[0:361]`

2020-08-08 Thread Guido van Rossum
This thread seems light on real use cases. I know there are people eager to have integer generics, since they are essential for typing numpy, pandas, tensorflow and friends. And so there are good proposals floating around for this on typing-sig; I expect implementations within a year. But integer

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-07-31 Thread Guido van Rossum
So maybe we need to add dict.ordered() which returns a view on the items that is a Sequence rather than a set? Or ordereditems(), orderedkeys() and orderedvalues()? On Fri, Jul 31, 2020 at 05:29 Ricky Teachey wrote: > On Fri, Jul 31, 2020, 2:48 AM Wes Turner wrote: > >> # Dicts and DataFrames

[Python-ideas] Re: basic matrix object

2020-08-13 Thread Guido van Rossum
ition, addition, linear problem solving, determinant.") On Thu, Aug 13, 2020 at 9:04 PM Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > Guido van Rossum writes: > > > I was going to say that such a matrix module would be better of in > > PyPI, but

[Python-ideas] Re: basic matrix object

2020-08-13 Thread Guido van Rossum
d an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/FARJRNHNLNGRVJA3ITSUSAJCXOUUYKA2/ > Code of Conduct: http://python.or

[Python-ideas] Re: Introduce a boundary parameter for typing.get_type_hints when used with a class object

2020-08-05 Thread Guido van Rossum
On Wed, Aug 5, 2020 at 12:25 AM Dominik Vilsmeier wrote: > On 04.08.20 22:05, Guido van Rossum wrote: > > Maybe get-type-hints can be refactored to make writing such a function > simpler. IIRC the part that takes a single annotation and evaluates it is a > private function. &g

[Python-ideas] Re: Decorators for class non function properties

2020-08-06 Thread Guido van Rossum
Maybe I’m lacking context, but I don’t understand the proposal. Can you explain the semantics and syntax you have in mind in more detail? How do you get from the first example (@my_property etc.) to the second (def name, def set_name)? —Guido On Thu, Aug 6, 2020 at 01:13 wrote: > I think a

[Python-ideas] Re: Idea: Extend "for ... else ..." to allow "for ... if break ..." else

2020-08-06 Thread Guido van Rossum
On Thu, Aug 6, 2020 at 01:00 Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > However, we would probably not want to burden all loops with the > exception-handling machinery, so the compiler would have to do some > hacky backtracking (I doubt that the arbitrary lookahead needed

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-07-31 Thread Guido van Rossum
be useful -- if it's infrequently, Chris B's own solution using islice() on the items() view looked pretty decent to me, and not that hard to come up with for someone who made it that far. For the former I expect that sooner or later someone will write a PEP and it will be accepted (assuming the PEP doe

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-07-31 Thread Guido van Rossum
. Another solution could be to make dict.ordered() fail if there are deleted keys. But that's not a great experience either. All in all I retract this idea. On Fri, Jul 31, 2020 at 5:31 PM Stestagg wrote: > On Sat, 1 Aug 2020 at 00:32, Guido van Rossum wrote: > >> If true this wou

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-07-31 Thread Guido van Rossum
Cs. I don't want to get into a similar situation with Set and Sequence, ever. And even though currently they *don't* have overlapping operations, the concrete types `list` and `set` *do* run into this kind of thing for comparison operators -- lists (and tuples) compare itemwise until a difference is foun

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-07-31 Thread Guido van Rossum
On Fri, Jul 31, 2020 at 7:59 PM Steven D'Aprano wrote: > On Fri, Jul 31, 2020 at 04:08:43PM -0700, Guido van Rossum wrote: > [...] > > I'm guessing that indexing by 0, if it were possible, would be a > convenient > > idiom to implement the "first item" op

[Python-ideas] Re: Decorators for class non function properties

2020-08-05 Thread Guido van Rossum
: if the decorator raises, the name remains unbound.) > @decorator over a binding `target = expression`: > > - bind `target = decorator("target", expression)` > > So we're adding significant complexity to the concept of "decorator". > (That said, I'm not a

[Python-ideas] Re: Escapes inside curly braces in f-strings

2020-06-30 Thread Guido van Rossum
On Mon, Jun 29, 2020 at 21:30 MRAB wrote: > On 2020-06-30 02:14, Steven D'Aprano wrote: > [snip] > > Counter-proposal: hex escapes allow optional curly brackets, similar to > > unicode name escapes. You could even allow spaces within the braces, for > > grouping: > > > > # Existing: > >

[Python-ideas] Re: Add __eq__ to colletions.abc.Sequence ?

2020-06-30 Thread Guido van Rossum
thon.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/BZTYVERLYDWPMW2QKSMDWXRRL3DUBSDC/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* &

[Python-ideas] Re: Add random.choice_iter for randomly selecting from an arbitrary iterable

2020-07-13 Thread Guido van Rossum
I think you all should get together and come up with a good implementation, and then petition Raymond Hettinger. Or maybe there is an existing open source 3rd party project that has code you can copy? I don’t recall if random has a C accelerator, but if it does, you should come up with C code as

[Python-ideas] Re: json library: non-standards-compliant by default, and what to do about it.

2020-06-16 Thread Guido van Rossum
e and energy be better aimed at fixing the standard rather than > making Python's JSON encoder broken by default? > You're kidding, right? -- --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-singul

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-21 Thread Guido van Rossum
On Sun, Jun 21, 2020 at 02:53 M.-A. Lemburg wrote: > On 21.06.2020 01:47, Guido van Rossum wrote: > > Hm, I remember Greg's free threading too, but that's not the idea I was > > trying to recall this time. There really was something about bytecode > > objects being lo

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Guido van Rossum
Steven just likes an argument. Nobody has ever taken the idea of a standard for language in comments seriously. It Just doen come up. On Fri, Jun 26, 2020 at 18:35 Bernardo Sulzbach < berna...@bernardosulzbach.com> wrote: > On Fri, Jun 26, 2020 at 9:43 PM Steven D'Aprano > wrote: > >> I dislike

[Python-ideas] Re: What about having a .get(index, default) method for arrays like we have for dicts?

2020-06-27 Thread Guido van Rossum
Please read PEP 505 before rehashing this old idea. On Sat, Jun 27, 2020 at 06:35 Daniel. wrote: > When I need to traverse nested dicts, is a common pattern to do > > somedict.get('foo', {}).get('bar', {}) > > But there is no such equivalent for arrays, wouldn't be nice if we can > follow > >

[Python-ideas] Re: For quicker execution, don't refcount objects that can't be deleted

2020-06-16 Thread Guido van Rossum
n-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/CB7AS43PNVNVGCR4VLE3ML76UMMFMS2P/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Gu

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-19 Thread Guido van Rossum
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-ideas mailing list -- python-ideas@python.org To unsubscrib

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-22 Thread Guido van Rossum
I like where this is going. It would be nice if certain constants could also be loaded from RO memory. On Mon, Jun 22, 2020 at 00:16 Inada Naoki wrote: > On Mon, Jun 22, 2020 at 12:00 AM Guido van Rossum > wrote: > > > > > > I believe this was what Greg Stein's idea

[Python-ideas] Re: Proposal to introduce pattern matching syntax

2020-06-22 Thread Guido van Rossum
rently stops at the first matching block it comes > to, not the best match out of all blocks. This is meant to make it easier > to understand the “flow” of the statement, but it might be preferable to > execute the block associated with the best match, though this would >

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-20 Thread Guido van Rossum
the platform with the fastest > locking primitive (Windows at the time) it slowed down single-threaded > execution nearly two-fold. > > Guido also referenced this write-up from Greg: > https://mail.python.org/pipermail/python-dev/2001-August/017099.html > > I hope this helps

[Python-ideas] Bringing the print statement back

2020-06-09 Thread Guido van Rossum
= (len "abc") ^ SyntaxError: invalid syntax >>> I think that strikes a reasonable balance between usability and reduced detection of common errors. I could also dial it back a bit, e.g. maybe it's too much to allow 'C().foo x' and we should only allow dotted names

[Python-ideas] Re: [Python-Dev] Making asyncio more thread-friendly

2020-06-08 Thread Guido van Rossum
n how to best structure your gradual migration within asyncio's current limitations, rather than trying to propose deep changes to the standard library. Sorry the news is not better, but you will be better off this way. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is

[Python-ideas] Re: Bringing the print statement back

2020-06-10 Thread Guido van Rossum
ad, so we can lay this one to rest.) All in all, it's clear that there's no future for this idea, and I will happily withdraw it. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-us

[Python-ideas] Re: Make `del x` an expression evaluating to `x`

2020-06-12 Thread Guido van Rossum
would seem to have no choice but to print the returned value -- the REPL has no indication that it came from `del`. -- --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-ideas] Re: Make `del x` an expression evaluating to `x`

2020-06-12 Thread Guido van Rossum
ntaxError in statement mode, it > would simply produce a different ast node: > > * `del x` -> `Delete(x)` (as `x := 0` -> SyntaxError) > * `(del x)` -> `Expr(DeleteExpr(x))` (as `(x := 0)` -> > `Expr(NamedExpr(...))`) > > Eric > > On Fri, 12 Jun 2020 at 17:21,

[Python-ideas] Re: For quicker execution, don't refcount objects that can't be deleted

2020-06-14 Thread Guido van Rossum
-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/RYMLY4IVTCTIXZRXQAVLBKO4ZQAEH3WG/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Ro

[Python-ideas] Re: Faster object representation for UIs

2020-07-24 Thread Guido van Rossum
But adding an optional parameter to an existing dunder is pretty much the worst choice. Every existing method of that name would have to be altered, or you’d end up with horrible code to cope with it — either catching exceptions or introspection. On Fri, Jul 24, 2020 at 10:35 Bernat Gabor wrote:

[Python-ideas] Re: Fwd: Re: Experimenting with dict performance, and an immutable dict

2020-07-25 Thread Guido van Rossum
interesting idea. It has always vaguely bothered me that `*args` gives a tuple while `**kwds` gives a dict. Unfortunately it's impossible to change without breaking tons of existing code, since things like `kwds.pop("something")` have become a pretty standard idiom to use it. -- --Guido

[Python-ideas] Re: Missing link to git repo on the “Source code” page

2020-07-16 Thread Guido van Rossum
Hello Hans, This list is more for ideas related to Python the language. For the website, each page on python.org has a link at the bottom to the tracker where you can submit requests for improvements and PRs for the website itself. —Guido On Thu, Jul 16, 2020 at 04:31 Hans Ginzel wrote: >

[Python-ideas] Re: PEP 472 -- Support for indexing with keyword arguments

2020-07-16 Thread Guido van Rossum
I think it’s a reasonable idea and encourage you to start working on a design for the API and then a PRP. It would help if someone looked into a prototype implementation as well (once a design has been settled on). On Thu, Jul 16, 2020 at 03:31 Steven D'Aprano wrote: > On Wed, Jul 15, 2020 at

[Python-ideas] Re: Alternative syntax for Callable type-hinting

2020-07-28 Thread Guido van Rossum
On Tue, Jul 28, 2020 at 05:42 Thiago Carvalho D' Ávila < thiagocav...@gmail.com> wrote: > The idea here is to use the same operator already used to type-hint the > return of functions `->` to define the return of a Callable. > > * Current syntax: > > Callable[[ArgumentList], ReturnType] > > eg. >

[Python-ideas] Re: Idea: Extend "for ... else ..." to allow "for ... if break ..." else

2020-07-28 Thread Guido van Rossum
Rest assured this is not a problem. In any case it’s the compiler, not the parser, that generates the bytecode, from the AST. The compiler always has the full AST available before it is asked to generate any bytecode. The new parser just allows more flexible syntactic constructs, esp. “soft

[Python-ideas] Re: Idea: Extend "for ... else ..." to allow "for ... if break ..." else

2020-07-29 Thread Guido van Rossum
On Wed, Jul 29, 2020 at 02:51 Mathew Elman wrote: > > . > >> If it *is* useful, it occurs to me that (1) this looks a lot like the >> try ... except ... pattern, and (2) breaks are generally perceived as >> exceptional exits from a loop. Instead of "if break [LABEL]", "except >> [LABEL]" might

[Python-ideas] Re: Idea: Extend "for ... else ..." to allow "for ... if break ..." else

2020-07-29 Thread Guido van Rossum
On Wed, Jul 29, 2020 at 07:01 Mathew Elman wrote: > > > On Wed, 29 Jul 2020 at 14:42, Guido van Rossum wrote: > >> On Wed, Jul 29, 2020 at 02:51 Mathew Elman >> wrote: >> >>> >>> . >>> >>>> If it *is* useful, it occurs to

[Python-ideas] Re: Thoughts about implementing object-compare in unittest package?

2020-07-26 Thread Guido van Rossum
ved at >> https://mail.python.org/archives/list/python-ideas@python.org/message/MLRFS6RO7WF2UAEOS4YMH2FXRQHJUGWU/ >> Code of Conduct: http://python.org/psf/codeofconduct/ >> > ___ > Python-ideas mailing list -

[Python-ideas] Re: Simplifying functions syntax

2020-07-20 Thread Guido van Rossum
t;What's the difference between def and fun? > Which should I use?", doesn't make life easier for teachers. > > > -- > Steven > ___________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...

[Python-ideas] Re: isolating user allocations

2020-07-20 Thread Guido van Rossum
3 is most likely "no" due to the > costs, but it would be nice if someone could weigh in on this part. Maybe > there's some workaround. > If you were asking me to weigh in *now* I'd say "no", if only because you haven't explained the reason why this is needed. And if you ha

[Python-ideas] Re: isolating user allocations

2020-07-20 Thread Guido van Rossum
as been done before for C/C++ ( > https://people.cs.umass.edu/~emery/pubs/dthreads-sosp11.pdf), but for > different reasons. > > On Mon, Jul 20, 2020 at 8:16 PM Guido van Rossum wrote: > >> On Mon, Jul 20, 2020 at 4:09 PM Wenjun Huang >> wrote: >> >>>

[Python-ideas] Re: isolating user allocations

2020-07-19 Thread Guido van Rossum
What purpose do you have in mind for making this distinction? Even if it could be done easily (which I doubt), why would this be useful? On Sun, Jul 19, 2020 at 19:01 wrote: > Hello, > > The API provided by PEP 445 makes it possible to intercept allocation > requests through hooks, but it seems

[Python-ideas] Re: PEP 472 -- Support for indexing with keyword arguments

2020-07-21 Thread Guido van Rossum
You have to find a core dev who is willing to act as a Sponsor. I recommend asking Steven d’Aprano (but I do not know if he’s interested). Until then, hash out the precise spec for the idea here. Coming up with a solid motivation is also important. On Tue, Jul 21, 2020 at 01:15 Stefano Borini

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-07-21 Thread Guido van Rossum
I think this cannot just be considered a bug fix, and it seems somewhat fundamental (catching arbitrary exceptions is controversial), so I recommend finding a core dev to sponsor a PEP. (Or finding one who thinks it is obviously a bug and will approve a PR.) On Tue, Jul 21, 2020 at 04:43 Dominik

[Python-ideas] Re: Experimenting with dict performance, and an immutable dict

2020-07-22 Thread Guido van Rossum
Did you study PEP 416 (frozendict) and PEP 603 (frozenmap)? -- --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-wo

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-07-30 Thread Guido van Rossum
On Thu, Jul 30, 2020 at 22:23 Greg Ewing wrote: > On 31/07/20 4:04 am, Christopher Barker wrote: > > (Side note: why ARE the views provided by methods, rather than > > properties?) > > Probably because they construct objects, and are therefore > somewhat more expensive than is usually expected

[Python-ideas] Re: New clause in FOR and WHILE instead of ELSE

2020-07-20 Thread Guido van Rossum
On Mon, Jul 20, 2020 at 03:22 Jonathan Fine wrote: > This is a continuation of my previous post to this thread. > > Python's FOR ... ELSE ... , Raymond Hettinger has told us, has origins in > some ideas of Don Knuth. > That’s news to me (both that it’s due to Knuth and that Raymond said so). I

[Python-ideas] Re: New clause in FOR and WHILE instead of ELSE

2020-07-20 Thread Guido van Rossum
Also, let me be clear that this feature will never be added to the language. On Mon, Jul 20, 2020 at 07:36 Guido van Rossum wrote: > On Mon, Jul 20, 2020 at 03:22 Jonathan Fine wrote: > >> This is a continuation of my previous post to this thread. >> >> Python's FO

[Python-ideas] Re: PEP 472 - regarding d[x=1, y=2] and similar

2020-08-15 Thread Guido van Rossum
es based on that. FWIW in my example I sorted the keywords, so that `d[x=1, y=2]` and `d[y=2, x=1]` construct the same internal key. But for some use cases it might be better if these constructed *different* internal keys. For example, Caleb's Struct class, when used to construct a dataclass, woul

[Python-ideas] Re: PEP 472 - regarding d[x=1, y=2] and similar

2020-08-15 Thread Guido van Rossum
that for xarray it is important to distinguish between `d[day=3, detector=4]` and `d[detector=4, day=3]`? If we just passed the keyword args to `__getitem__` as an extra `**kwds` argument (which preserves order, since Python 3.6 at least), that should work, right? If not, can you clarify? --

[Python-ideas] Re: PEP 472 - regarding d[x=1, y=2] and similar

2020-08-15 Thread Guido van Rossum
can already do with a class definition and annotations). And without static checking this isn't going to be very popular. If and when we have `__getitem__` with keyword args we can start thinking about how to best leverage it in type annotations -- I would assume that describing axes of objects like

[Python-ideas] Re: PEP 472 - regarding d[x=1, y=2] and similar

2020-08-15 Thread Guido van Rossum
quot; is a naughty term. (I find "runtime use of annotations" much naughtier. :-) -- --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-ideas] Re: PEP 472 - regarding d[x=1, y=2] and similar

2020-08-16 Thread Guido van Rossum
On Sun, Aug 16, 2020 at 5:45 AM Steven D'Aprano wrote: > On Mon, Aug 17, 2020 at 12:32:08AM +1200, Greg Ewing wrote: > > On 16/08/20 11:49 am, Guido van Rossum wrote: > > >SEMANTICS OF NO ARGUMENTS > > >I can see two basic ways of

[Python-ideas] Re: PEP 472 - regarding d[x=1, y=2] and similar

2020-08-16 Thread Guido van Rossum
On Sat, Aug 15, 2020 at 10:00 PM Steven D'Aprano wrote: > On Sat, Aug 15, 2020 at 08:26:10PM -0700, Guido van Rossum wrote: > > > Are you saying that for xarray it is important to distinguish between > > `d[day=3, detector=4]` and `d[detector=4, day=3]`? If we just passed th

[Python-ideas] Re: Unpack operator "**" and Mapping

2020-12-29 Thread Guido van Rossum
will probably prefer `obj.__dict__` over `vars(obj)` too :-) > Not a valid analogy. -- --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-ideas] Re: Unpack operator "**" and Mapping

2020-12-29 Thread Guido van Rossum
On Mon, Dec 28, 2020 at 11:36 PM Christopher Barker wrote: > On Mon, Dec 28, 2020 at 12:33 PM Guido van Rossum > wrote: > >> On Mon, Dec 28, 2020 at 12:15 PM Christopher Barker >> wrote: >> >>> Though frankly, I would rather have had it use .items() -- see

[Python-ideas] Re: Move semantics

2020-11-26 Thread Guido van Rossum
he caller didn't bind it to keep hold of it. > Sounds like one of you is describing current semantics and the other is explaining the proposed new semantics. :-) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using

[Python-ideas] Re: Making "Any" a builtin

2020-11-29 Thread Guido van Rossum
t; Inada Naoki > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://m

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-29 Thread Guido van Rossum
er problems, in addition to giving us a cleaner way to solve the value capture problem. -- --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-ideas] Re: PEP 634-636: Mapping patterns and extra keys

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

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-25 Thread Guido van Rossum
gt; https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/VKHB722PLUMZJPCMHEM2MB4HBEDI463Y/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.or

[Python-ideas] Re: Move semantics

2020-11-26 Thread Guido van Rossum
on-ideas@python.org/message/WJXFEVKR3IU7BAI57DFUUZZYS6UA3P6N/ > 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

[Python-ideas] Re: Proposal for __encode__ method for json encoder and dataclasses

2020-12-09 Thread Guido van Rossum
Maybe you could start by writing this as a separate decorator, to be applied on top of the data class decorator? On Wed, Dec 9, 2020 at 05:38 sam bland wrote: > In response to the additional work required to convert the new python > dataclass using the json encoder I propose an __encode__

[Python-ideas] Re: Move semantics

2020-11-26 Thread Guido van Rossum
y familiar with that field to be able to point you to examples. Hopefully there are readers here who can. (Nate?) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-26 Thread Guido van Rossum
Council (not me). (Why do I propose "let" and not "const"? It seems "let" has become the industry standard language. The other day I saw a reference to a LET() function in Excel. :-) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)

[Python-ideas] Re: Matching TypedDicts and other values in JSON

2020-11-23 Thread Guido van Rossum
I recommend taking this to typing-sig... On Mon, Nov 23, 2020 at 19:18 David Foster wrote: > On 11/22/20 10:15 AM, Guido van Rossum wrote: > > - We intentionally don't support things like `isinstance(x, List[str])` > > because that would require checking all the items with `

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Guido van Rossum
r I think because it encourages python users to > annotate their functions. > Indeed. Shantanu did some quick counting and found that after 'Any' and the types covered by PEP 585, Callable is by far the most used: https://bugs.python.org/issue42102#msg381155 -- --Guido van Rossum (python.org/~guid

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Guido van Rossum
ality. > Hm, but using Protocol you can already express every callable type. We could duplicate all of the complexity of 'def' parameter lists into the type notation, but it would be very complex. So this requirement is at least debatable (I'm not actually sure how I feel about it). -- --G

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Guido van Rossum
; readable when lots of nesting is involved, but I suspect that's just > because the type is just complicated. :) ) > You could simplify it by judicious application of type aliases. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <ht

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-28 Thread Guido van Rossum
were to drive this through quickly enough we could even make it apply to pattern matching captures. (Or maybe pattern matching could get these semantics anyway.) My bus is here, so that's it, -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministin

[Python-ideas] Re: Callable annotation featureset [Was: Alternative to Callable Annotation]

2020-11-29 Thread Guido van Rossum
common case). The rule would be something like "if there's no /, a / is assumed at the end", and also "in positional args, the syntax is [name ':'] type_expr ['=' default_expr]." Gotta go, On Sun, Nov 29, 2020 at 12:02 AM Andrew Svetlov wrote: > On Sun, Nov 29, 2020 at 1:49 AM G

[Python-ideas] Re: [RFC] Built-in shorthand b() for breakpoint()

2020-12-02 Thread Guido van Rossum
g/archives/list/python-ideas@python.org/message/6UAJRDKVJNZ7EACXUTUCKSGAEYPJHME5/ > 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-

[Python-ideas] Re: __init__ in module names

2020-12-10 Thread Guido van Rossum
harm inflicted by dropping support for "__init__" in module names will > be more than compensated by long-term benefits of enabling turnkey Python > application distribution. But that's my personal take and I have no solid > evidence to justify that claim. The evidence that PathFind

[Python-ideas] Re: a new data type: NamedValue -- similar to Enum

2020-12-12 Thread Guido van Rossum
g this either. Can you give an example of something that doesn't work with Enum (and shouldn't work) but should work with NamedValues? Finally, why the plural in the name, where Enum and friends all have singular names? -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why

[Python-ideas] Re: Proposal: typing.affix_type_hints

2020-12-10 Thread Guido van Rossum
uated values when get_type_hints is > called? > > 2. Something I haven't considered? Please let me know. > > > Paul > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@py

[Python-ideas] Re: __init__ in module names

2020-12-10 Thread Guido van Rossum
On Thu, Dec 10, 2020 at 1:22 PM Steven D'Aprano wrote: > On Thu, Dec 10, 2020 at 10:57:32AM -0800, Guido van Rossum wrote: > > > All I have to add is that I am appalled that people actually write `from > > foo import __init__` > > I too would be appalled if that w

[Python-ideas] Re: built in to clear terminal

2020-12-19 Thread Guido van Rossum
a few times.) I can't comment on the exact semantics or implementation (though I'd prefer it if it didn't have to run a subprocess). IDLE should probably monkey-patch this so it does something reasonable in its shell window. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(w

[Python-ideas] Re: PEP 634-636: Mapping patterns and extra keys

2020-11-14 Thread Guido van Rossum
It’s a usability issue; mappings are used quite differently than sequences. Compare to class patterns rather than sequence patterns. On Sat, Nov 14, 2020 at 22:04 David Foster wrote: > From PEP 636 (Structural Pattern Matching): > > Mapping patterns: {"bandwidth": b, "latency": l} captures

[Python-ideas] Re: PEP 634-636: Mapping patterns and extra keys

2020-11-14 Thread Guido van Rossum
David Foster wrote: > On 11/14/20 10:17 PM, Guido van Rossum wrote: > > It’s a usability issue; mappings are used quite differently than > > sequences. Compare to class patterns rather than sequence patterns. > > I just found the following explanation from the superceded PEP

[Python-ideas] Re: PEP 634-636: Mapping patterns and extra keys

2020-11-17 Thread Guido van Rossum
Go for it. This is a pretty minor issue but we want to get it right. Data is helpful. On Tue, Nov 17, 2020 at 06:58 David Foster wrote: > On 11/15/20 12:11 AM, Steven D'Aprano wrote: > > It would be good if the PEP gave a survey of the practical experience of > > other languages with pattern

[Python-ideas] Re: Matching TypedDicts and other values in JSON

2020-11-22 Thread Guido van Rossum
thread on typing-sig and we'll discuss it. -- --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-ideas m

<    2   3   4   5   6   7   8   9   >