[Python-ideas] Re: Generic NamedTuples

2021-02-08 Thread Guido van Rossum
ail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/XZVZT3U237UCEI4FT6MZVU5MBZICV6ST/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pro

[Python-ideas] Re: [Python-Dev] What's up with assignment expression and tuples?

2021-02-08 Thread Guido van Rossum
This was intentional in PEP 572 so it is not a grammar bug fix. Put your money where your mouth is, or become another armchair language designer. Your choice. On Sun, Feb 7, 2021 at 23:58 Paul Sokolovsky wrote: > Hello, > > On Sun, 7 Feb 2021 13:10:55 -0800 > Guido van Rossum wro

[Python-ideas] Re: Type hinting **kwargs

2021-02-07 Thread Guido van Rossum
gt; > ___ > 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/ar

[Python-ideas] Re: [Python-Dev] What's up with assignment expression and tuples?

2021-02-07 Thread Guido van Rossum
Hi Paul, I suggest that you just go straight to the PEP phase. --Guido On Thu, Feb 4, 2021 at 11:54 PM Paul Sokolovsky wrote: > Hello, > > Everyone knows how hard to find a compelling usecase for the assignment > expression operator (":=", colloquially "

[Python-ideas] Re: Top Level Await in Python like in Deno

2021-02-06 Thread Guido van Rossum
The proposal is to add a default event loop that is always active. On Sat, Feb 6, 2021 at 06:41 wrote: > I mean to be able to do something like this: > ```python > import asyncio > > await asyncio.sleep(1); > ``` > -- --Guido (mobile) _

[Python-ideas] Re: Make UTF-8 mode more accessible for Windows users.

2021-02-04 Thread Guido van Rossum
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/N4HV3CM3QAUNZA4XRP2PQTNNR2BV7H2V/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido (mobile) ___

[Python-ideas] Re: Questions about using PEP 637 syntax in PEP 646

2021-01-29 Thread Guido van Rossum
nk it's fine the way you have implemented it -- since there is a difference between a[1] and a[1,], a[*t] where len(t) == 1 has to make a choice, and it's fine if this always passes a tuple. > > 2. Does PEP 637 allow a positional argument after a `*`? > >- e.g., Generi

[Python-ideas] Re: Provide UTF-8 version of Python for Windows.

2021-01-25 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/

[Python-ideas] Re: Adding `open_text()` builtin function. (relating to PEP 597)

2021-01-25 Thread Guido van Rossum
On Mon, Jan 25, 2021 at 5:49 PM Inada Naoki wrote: > On Tue, Jan 26, 2021 at 10:22 AM Guido van Rossum > wrote: > > > > > > Older Pythons may be easy to drop, but I'm not so sure about older > unofficial docs. The open() function is very popular and there must

[Python-ideas] Re: Adding `open_text()` builtin function. (relating to PEP 597)

2021-01-25 Thread Guido van Rossum
thon but good at SEO). I would be very sad if the official recommendation had to become "[for the most common case] avoid open(filename), use open_text(filename)". BTW remind me what open_text() would do? How would it differ from open() with the same arguments? That's too many messa

[Python-ideas] Re: Adding `open_text()` builtin function. (relating to PEP 597)

2021-01-23 Thread Guido van Rossum
I have definitely seen BOMs written by Notepad on Windows 10. Why can’t the future be that open() in text mode guesses the encoding? -- --Guido (mobile) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python

[Python-ideas] Re: Making TYPE_CHECKING builtin.

2021-01-18 Thread Guido van Rossum
st -- 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.org/message/P5W5ETPGVXN47OW27RICUQQRJZCBVFKQ/ >

[Python-ideas] Re: A PEP to encourage people to mind docstrings in stub files

2021-01-01 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/py

[Python-ideas] Re: On the history and usage of vars [was Re: Re: Unpack operator "**" and Mapping]

2020-12-30 Thread Guido van Rossum
On Wed, Dec 30, 2020 at 5:01 PM Steven D'Aprano wrote: > On Tue, Dec 29, 2020 at 09:02:10AM -0800, Guido van Rossum wrote: > > On Tue, Dec 29, 2020 at 8:11 AM Steven D'Aprano > wrote: > > > To the contrary, vars() is something I added to the language for the >

[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: Unpack operator "**" and Mapping

2020-12-29 Thread Guido van Rossum
? Then you > 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-28 Thread Guido van Rossum
nces to be differentiably using dunders only. But it's about 31 years too late for that. And looking at the mess JavaScript made of this (sequences are mappings with string keys "0", "1" and so on), I'm pretty happy with how Python did this. -- --Guido van Rossum (python.

[Python-ideas] Re: asyncio.Pipe()

2020-12-28 Thread Guido van Rossum
dout/stdin. > > On Mon, Dec 28, 2020 at 12:50 PM Guido van Rossum > wrote: > >> The asyncio module already has a subprocess support: Subprocesses — >> Python 3.9.1 documentation >> <https://docs.python.org/3/library/asyncio-subprocess.html> >> >> Was

[Python-ideas] Re: asyncio.Pipe()

2020-12-28 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

[Python-ideas] Re: Add aggregations and joins code-generating library along with itertools

2020-12-28 Thread Guido van Rossum
Dear Nikita, I'm sorry to squash your idea, but I don't think your library is mature enough to be considered for inclusion in the standard library. May 2021 be an improvement upon 2020, --Guido On Sun, Dec 27, 2020 at 7:04 AM Nikita Almakov wrote: > Hello everyone! > > Th

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

2020-12-19 Thread Guido van Rossum
this need clearly 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

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

2020-12-12 Thread Guido van Rossum
t following 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) *Pron

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

2020-12-10 Thread Guido van Rossum
a > way for ForwardRef to cache evaluated 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 unsub

[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 was

[Python-ideas] Re: __init__ in module names

2020-12-10 Thread Guido van Rossum
s the value of Python in the larger ecosystem. My opinion is > the 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 ha

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

2020-12-09 Thread Guido van Rossum
on-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/YGUCQH2XGERESIIWZ4TBU74HJKZATDWB/ > Code of Conduct: http://python

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

2020-12-02 Thread Guido van Rossum
hts? It is worth > drafting a new PEP for this idea? > > > Bests, > Qingyao > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman

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

2020-11-29 Thread Guido van Rossum
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
usable to solve a whole bunch of other 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-chang

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

2020-11-29 Thread Guido van Rossum
ll a very 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:

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Guido van Rossum
yntax is particularly > 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 **(wh

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

2020-11-28 Thread Guido van Rossum
hat comprehensions implicitly use 'for let ...'. If we 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/~

[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 abou

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Guido van Rossum
, the better 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

[Python-ideas] Re: Move semantics

2020-11-26 Thread Guido van Rossum
> because the 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

[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: Move semantics

2020-11-26 Thread Guido van Rossum
yet sufficiently 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/ho

[Python-ideas] Re: Move semantics

2020-11-26 Thread Guido van Rossum
/list/python-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-

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

2020-11-25 Thread Guido van Rossum
works, and that having to write 'for new x in ...' is no better, because you'd still forget it. Maybe we should consider introducing a new kind of function that captures values instead? That would be a much more principled fix. --Guido On Thu, Nov 19, 2020 at 4:20 PM Ben Rudiak-Gould

[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 w

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

2020-11-22 Thread Guido van Rossum
On Sun, Nov 22, 2020 at 1:55 PM Samuel Colvin wrote: > More generally, I think runtime type checking was never the intention for > type hints, in fact I think Guido specifically said somewhere that runtime > type checking was not an intended use case (am I right?). However > pydant

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

2020-11-22 Thread Guido van Rossum
at do support isinstance(), so you could write e.g. ICircle = make_interface(Circle) IRect = make_interface(Rect) # etc. def draw_shape(): match request.json: case ICircle(center, radius): ... case IRect(x, y, width, height): ... ... but this loses much of the original at

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

2020-11-21 Thread Guido van Rossum
> I've completed my survey of how other languages use pattern matching to > > match Mapping-like and dict-like types, especially focusing on whether > > they ignore (𝔸) or disallow (𝔹) extra keys by default. [...] > > To close the loop on this thread: > > * Based

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

2020-11-17 Thread Guido van Rossum
essage/WBTOEFRUWB2MQWZ7OTJB6ME2IMSZXTPM/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido (mobile) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.pyt

[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-14 Thread Guido van Rossum
; > def parse_todo_item(todo_item_json: Dict) -> TodoItem_ReadWrite: > match todo_item_json: > case {'title': str(title), 'completed': bool(completed), > **extra}: > return TodoItem_

[Python-ideas] Re: unix filter, one liners, awk

2020-11-05 Thread Guido van Rossum
@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/IT5MXIZB3LSMZTHJHVFCFADSGZOW4S2Y/ > Code of Conduct:

[Python-ideas] Re: [Suspected Spam]Re: Dict unpacking assignment

2020-10-31 Thread Guido van Rossum
On Sat, Oct 31, 2020 at 21:47 Steven D'Aprano wrote: > On Sat, Oct 31, 2020 at 09:05:43PM -0700, Guido van Rossum wrote: > > > Hm, for PEP 622/634 we looked at this and ended up making it so that this > > is the default -- you only have to write > > ``` > > {&#

[Python-ideas] Re: [Suspected Spam]Re: Dict unpacking assignment

2020-10-31 Thread Guido van Rossum
ly have to write ``` {'spam': spam, 'eggs': eggs} = mapping ``` and any extra keys are ignored. This is because for the common use case here we want to ignore extra keys, not insist there aren't any. (We wrote it up a little better in the Mapping Patterns section of PEP 635

[Python-ideas] Re: Dict unpacking assignment

2020-10-25 Thread Guido van Rossum
rse(): assignment to fstrings > ___ > 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/

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

2020-10-23 Thread Guido van Rossum
ython-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.org/message/MJ7JHYKHKB2T4SCFV4TX4IMKUANUAF5B/ >

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

2020-10-23 Thread Guido van Rossum
's 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-si

[Python-ideas] Re: Dict unpacking assignment

2020-10-22 Thread Guido van Rossum
sition or by name: > > > height, width = get_dimensions(window) # returns a tuple > height, width = **get_dimensions(window) # returns a mapping > > Developers can choose whichever model best suits their API. > > Another use-case is dealing wi

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

2020-10-22 Thread Guido van Rossum
On Thu, Oct 22, 2020 at 3:37 AM Hans Ginzel wrote: > Thank you for (ugly) workaorund. > Careful who you're calling ugly. -- --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-pron

[Python-ideas] Re: f-strings as assignment targets

2020-10-22 Thread Guido van Rossum
} {b} {c}": print("Triple", a, b, c) ``` Everything else (e.g. how to design the formatting language) would be open. We could even designate "raw" f-strings (rf"...") as regular expressions (). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my

[Python-ideas] Re: f-strings as assignment targets

2020-10-21 Thread Guido van Rossum
uot; > foo, bar, baz = scan_to_tuple(pat_only, haystack) > # names, if bound, have the types indicated by scanning language > > There are questions open about partial matching, defaults, exceptions to > raise, etc. But the general utility of something along those lines seems > roughly

[Python-ideas] Re: f-strings as assignment targets

2020-10-21 Thread Guido van Rossum
ying that it wouldn't be useful or practical. Not really sure > how this works. > > ChrisA > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.py

[Python-ideas] Re: Call a function at invocation

2020-10-20 Thread Guido van Rossum
The ‘if __name__…’ idiom makes one function special. Hm... So if the module has that, will that main() still be called with your proposal? I.e., is __name__ still ‘__main__’? On Tue, Oct 20, 2020 at 20:32 Michael Smith wrote: > > > On Tue, Oct 20, 2020 at 23:12 Guido van Rossum wrote

[Python-ideas] Re: Call a function at invocation

2020-10-20 Thread Guido van Rossum
On Tue, Oct 20, 2020 at 8:06 PM Michael Smith wrote: > On Tue, Oct 20, 2020 at 10:19 PM Guido van Rossum > wrote: > > > > I think it would be a tad more convincing if there was a way to pass > arguments too (even if just a list of strings). At the very least extra > ar

[Python-ideas] Re: Call a function at invocation

2020-10-20 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.org/message/JWLFO

[Python-ideas] Re: Optimize out setting unused underscored local variables

2020-10-20 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/pytho

[Python-ideas] Re: Optimize out setting unused underscored local variables

2020-10-20 Thread Guido van Rossum
g > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/UF22D3FOJIA4JAHEV4FPMZLIG6XE7V3X/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python

[Python-ideas] Re: New feature

2020-10-15 Thread Guido van Rossum
and perhaps IDLE (or some enterprising IDLE hacker) can monkey-patch that to do whatever makes IDLE's shell reset. On Thu, Oct 15, 2020 at 4:52 PM Mike Miller wrote: > > On 2020-10-13 15:35, Guido van Rossum wrote: > > Can one of the educators on the list explain why this is such a co

[Python-ideas] Re: Exact decimal multiplication and division operations

2020-10-14 Thread Guido van Rossum
g to do so, only that it surprised me when > I first discovered it. > > > -- > Steve > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.pytho

[Python-ideas] Re: New feature

2020-10-13 Thread Guido van Rossum
st -- 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.org/message/MX54AOXMYJHGRVOO2XW3J7JWHQDDUKPQ/ >

[Python-ideas] Re: Allow writing optional types as ?int

2020-10-07 Thread Guido van Rossum
t; > ___ > 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.or

[Python-ideas] Re: Variadic generics PEP draft

2020-10-07 Thread Guido van Rossum
n-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.org/message/FKXO4KOAMP3TZ22T

[Python-ideas] Re: SupportsString Protocol Type Annotation

2020-10-07 Thread Guido van Rossum
On Wed, Oct 7, 2020 at 12:41 AM Serhiy Storchaka wrote: > 07.10.20 06:04, Guido van Rossum пише: > > Ironically, complex numbers have a `__float__` > > method that always fails, and floats don't have a `__complex__` method > > but complex(x) succeeds if x is a flo

[Python-ideas] Re: Method to efficiently advance iterators for sequences that support random access

2020-10-07 Thread Guido van Rossum
exing and slicing) that would change from O(1) to O(N) if the implementation changed to something other than an array. I'm not arguing against this proposal, or for it. I'm just mentioning > some considerations which should be considered :-) > Same here, for sure. Still wait

[Python-ideas] Re: Method to efficiently advance iterators for sequences that support random access

2020-10-06 Thread Guido van Rossum
) would require some kind of buffering to build them out of the basics. I would expect that, given a sufficiently compelling real-world > use-case, we would be prepared to add a jump ahead method to > list-iterators, as a specific feature of that iterator, not of all > iterators. But

[Python-ideas] Re: CPP Namespaces For Python

2020-10-06 Thread Guido van Rossum
s a pain to combine two different metaclasses. > namespace Foo: > x=1 > def bar(): > pass > def baz() > return bar() + x > That could be done with a function and a function decorator. "Proof left as an exercise for the reader." :-) -- --Guido v

[Python-ideas] Re: SupportsString Protocol Type Annotation

2020-10-06 Thread Guido van Rossum
ecedent -- though it's a questionable one (Luciano discovered this). It shows how tricky these things are though. There's a `typing.SupportsFoat` protocol that checks for the presence of a `__float__` method, and a `typing.SupportsComplex` protocol that checks for `__complex__`. Ironical

[Python-ideas] Re: Method to efficiently advance iterators for sequences that support random access

2020-10-06 Thread Guido van Rossum
I’m still waiting for an example of a real app where this matters. -- --Guido (mobile) ___ 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

[Python-ideas] Re: PEP 637 - support for indexing with keyword arguments

2020-10-06 Thread Guido van Rossum
field stating that the existing slots take a dict as argument. I'm not sure that we need a vector style API here -- I have a feeling that this isn't going to be performance critical. (Certainly not for most people, and not for the PEP authors' use cases.) If you really want

[Python-ideas] Re: SupportsString Protocol Type Annotation

2020-10-06 Thread Guido van Rossum
> https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/C66MLTYQNAL3KHZELGME62UQOVGAHM5L/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.o

[Python-ideas] Re: CPP Namespaces For Python

2020-10-06 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

[Python-ideas] Re: Trouble with "decorator mixins" and ABCs

2020-10-01 Thread Guido van Rossum
this behaviour into `dataclass` (and > possibly `total_ordering`), and let 3rd parties implement this logic > themselves. > > On Thu, Oct 1, 2020 at 5:08 PM Guido van Rossum wrote: > >> That might work (though not for older Python versions). What kind of API >> were you think

[Python-ideas] Re: Trouble with "decorator mixins" and ABCs

2020-10-01 Thread Guido van Rossum
> > example: @abstractmethod(True) # Method won't be included in required > implementations. Default: False (for bcompat reasons) > That's already possible: just don't use @abstractmethod at all. You can still override! -- --Guido van Rossum (python.org/~guido) *Pronoun

[Python-ideas] Re: Trouble with "decorator mixins" and ABCs

2020-10-01 Thread Guido van Rossum
the dev team probably knows better. If this is an accepted solution, I'd be > happy to write a BPO and PR. > > On Wed, Sep 30, 2020 at 5:30 PM Guido van Rossum wrote: > >> Would it help if ‘__abstractmethods__’ was documented, overruling >> whatever the PEP says? >&

[Python-ideas] Re: Trouble with "decorator mixins" and ABCs

2020-09-30 Thread Guido van Rossum
here an objection for >>> >>> implementing such a thing, or was it complex enough to >>> >>> postpone for the time being? >>> >>> >>> >>> >>> >> >> >> >> >> >> >> >> >>

[Python-ideas] Re: PEP 637 - support for indexing with keyword arguments (Was: Re: PEP 9999 (provisional): ...)

2020-09-29 Thread Guido van Rossum
At this point I think we're all set for use cases, both for keyword-only and for mixed use. Clearly a lot of libraries are going to be able to provide better APIs using this PEP, and mixed use of positionals and keywords will be quite useful to some of these. -- --Guido van Rossum (pytho

[Python-ideas] Re: PEP 637 and keyword only subscripts

2020-09-27 Thread Guido van Rossum
, when occurring in hard-coded arguments of either nature, may also be slices, e.g. `d[x]` could be `d[i:j]` or `d[i:j:k]` or e.g. `d[::]`. This makes no difference for the analysis. Note that in `*args` and `**kwargs` the slice notation is not syntactically valid -- but you can use explicit calls to `slice(

[Python-ideas] Re: PEP 637 and keyword only subscripts

2020-09-27 Thread Guido van Rossum
pecifically about this issue, and then have people seemingly not even > read it before writing back to disagree :-( +1 —Guido -- --Guido (mobile) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ide

[Python-ideas] Re: PEP 637 and keyword only subscripts

2020-09-26 Thread Guido van Rossum
obj[**d] = "foo" # no kwd arguments provided here > > ...which, if someone does this arbitrarily against classes that use the > existing kind of code I gave at the first, will call (if the sentinel is () > ): > > obj.__setitem__((), "foo") # [Correction by Guid

[Python-ideas] Re: PEP 637 - support for indexing with keyword arguments (Was: Re: PEP 9999 (provisional): ...)

2020-09-26 Thread Guido van Rossum
and I'm not sure that I see the gain, yet. > I'm obviously missing something. > Yes, reading through about 500 messages before the PEP was drafted. Nearly every aspect of this has been debated to death. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him *

[Python-ideas] Re: PEP 637 and keyword only subscripts

2020-09-26 Thread Guido van Rossum
On Fri, Sep 25, 2020 at 11:26 PM Ricky Teachey wrote: > On Sat, Sep 26, 2020 at 1:51 AM Guido van Rossum wrote: > >> But this requires introspection. >> > > I'm sorry Guido I'm staring at your message and reread mine several times > and I don't unde

[Python-ideas] Re: PEP 637 and keyword only subscripts

2020-09-25 Thread Guido van Rossum
em__(self, index, value, **kwargs): > if index is SENTINEL: > handle_kwd_args_only() > > --- > Ricky. > > "I've never met a Kentucky man who wasn't either thinking about going home > or actually going home." - Happy Chandler > >

[Python-ideas] Re: PEP 637 - support for indexing with keyword arguments (Was: Re: PEP 9999 (provisional): ...)

2020-09-24 Thread Guido van Rossum
ct of keywords. Looking through the existing APIs, I recommend PyObject_{Get,Set,Del}ItemWithKeywords instead. (Note you have a typo here, "DetItem". Also I recommend adding markup (e.g. bullets) so each signature is on a line by itself. That's it from me! -- --Guido van Rossum (pyth

[Python-ideas] Re: Trouble with "decorator mixins" and ABCs

2020-09-24 Thread Guido van Rossum
thon-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/6BNJ3YSEBPHEPGXSAZGBW3TJ64ZGZIHE/ > Code of Conduct: http://python.org/psf/codeofconduct/ >

[Python-ideas] Re: Allow arbitrary expressions in decorator syntax

2020-09-19 Thread Guido van Rossum
to make this do something useful. > > Granted, there is no rule resembling this anywhere else in Python, but > maybe an exception can be made here, to keep it consistent with the above? > What consistency? The consistent rule is that the gramma

[Python-ideas] Re: f-strings as assignment targets

2020-09-17 Thread Guido van Rossum
using a search engine. (Most queries lead to descriptions of regular expressions in Scala, or more general discussion of pattern matching in Scala.) Maybe that's indicative of some smell... But its existence suggests that this idea has actually been implemented quite

[Python-ideas] Re: A shortcut to load a JSON file into a dict : json.loadf

2020-09-14 Thread Guido van Rossum
create a bugs.python.org issue > to track it. Either way, it's up to the core devs to decide, but it > shouldn't need all the overhead of a full PEP. > It will still need a bpo issue, so might as well create one now. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him

[Python-ideas] Re: argparse.py in version 3.8.2 Action=Custom ActionClass needs an option to have methods

2020-09-13 Thread Guido van Rossum
Hi Ranga, I think I understand what you're after, but this really looks like something you can solve yourself in several ways (e.g. just creating classes that override one method) so I don't think it's worth changing the argparse module to support this directly. --Guido On Thu,

[Python-ideas] Re: A shortcut to load a JSON file into a dict : json.loadf

2020-09-11 Thread Guido van Rossum
On Fri, Sep 11, 2020 at 4:19 PM David Mertz wrote: > On Fri, Sep 11, 2020, 12:59 PM Guido van Rossum wrote: > >> What happened to "not every three-line function needs to be a built-in"? >> This is *literally* a three-line function. And I know the proposal is not

[Python-ideas] Re: Curious : Why staticmethod if classmethods can do everything a static method can?

2020-09-11 Thread Guido van Rossum
class from inside the method (in case it's called for a subclass). So I also added classmethod. But since staticmethod was already out of the bag, I kept it around, and it's found its uses (as you can see from other replies). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/h

[Python-ideas] Re: A shortcut to load a JSON file into a dict : json.loadf

2020-09-11 Thread Guido van Rossum
s-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/4XVZAXRXQKZKTJJAH4WHXFVQGA57YFAV/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Ro

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-11 Thread Guido van Rossum
On Fri, Sep 11, 2020 at 1:10 PM David Mertz wrote: > On Fri, Sep 11, 2020 at 8:58 AM Guido van Rossum wrote: > >> What's wrong with 1e1000? >> > > As a spelling of "infinity" generically, or just as an example of an > "arithmetic operation"?

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-11 Thread Guido van Rossum
.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/SI55GC4JYNC6XMVJRNT7SBVWHDIHRALK/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pro

[Python-ideas] Re: argparse.py in version 3.8.2 Action=Custom ActionClass needs an option to have methods

2020-09-10 Thread Guido van Rossum
Rangarajan, You may be on to something but the description is a bit dense. Can you show some examples of how this would work, and contrast those with how the same thing would have to be done without your proposed feature? —Guido On Thu, Sep 10, 2020 at 05:47 wrote: > Hi, > > Got the

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-09 Thread Guido van Rossum
The discussion on this list is plenty. Just write the PEP! On Wed, Sep 9, 2020 at 12:07 PM Cade Brown wrote: > All, > > For reference, my PEP repo: https://github.com/CadeBrown/peps > > > Guido, > > Thanks for helping out. And yes I'd be interested in writing a PEP.

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