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

2021-02-06 Thread Eryk Sun
On 2/6/21, Christopher Barker wrote: > On Sat, Feb 6, 2021 at 11:47 AM Eryk Sun wrote: > >> Relative to the installation, "python.cfg" should only be found in the >> same directory as the base executable, not its parent directory. > > OK, my mistake — I thought that was already the case with pyve

[Python-ideas] Re: Conditional with statements

2021-02-06 Thread Paul Sokolovsky
Hello, On Sat, 6 Feb 2021 19:57:33 -0500 Jonathan Crall wrote: > I ran into another case where I wish I had some sort of conditional > if. Right, conditional "if" is exactly what we miss in Python. Yes, it's a typo, but it's proverbial Freudian slip, shows what stays behind such proposals - un

[Python-ideas] Re: Conditional with statements

2021-02-06 Thread lasizoillo
El dom, 7 feb 2021 a las 3:08, MRAB () escribió: > On 2021-02-07 00:57, Jonathan Crall wrote: > > > [snip] > > > > To be clear, in the proposed syntax: > > > > if [condition] with [obj]: > > [code] > > > > Would behave exactly as: > > > > if [condition]: > > with [obj]:

[Python-ideas] Re: Conditional with statements

2021-02-06 Thread MRAB
On 2021-02-07 00:57, Jonathan Crall wrote: [snip] To be clear, in the proposed syntax:     if [condition] with [obj]:         [code] Would behave exactly as:     if [condition]:         with [obj]:             [code] Is there any chance that this conditional context manager syntax mi

[Python-ideas] Re: Conditional with statements

2021-02-06 Thread Jonathan Crall
I ran into another case where I wish I had some sort of conditional if. I was writing code to cache autogenerated demodata. import ubelt as ub from os.path import join import json kwargs = {'example': 'config'} dpath = ub.ensure_app_cache_dir('my_modname', 'demodata') fpa

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

2021-02-06 Thread Eryk Sun
On 2/6/21, Christopher Barker wrote: > On Fri, Feb 5, 2021 at 12:59 PM Eryk Sun wrote: > > But why limit it to that? If there are more things to configure in an > environment-specific way — why not put it in this existing location? I'd rather not limit the capability to just virtual environments

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

2021-02-06 Thread Christopher Barker
On Fri, Feb 5, 2021 at 12:59 PM Eryk Sun wrote: > I don't like extending "pyvenv.cfg" with generic settings. This is a > file to configure a virtual environment Yes indeed. in terms of finding the > standard library and packages. But why limit it to that? If there are more things to configur

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

2021-02-06 Thread Matthias Bussonnier
If it's for the REPL, it's already there, you simply need to start the async REPL. $ python -m asyncio asyncio REPL 3.8.5 | packaged by conda-forge | (default, Sep 16 2020, 17:43:11) [Clang 10.0.1 ] on darwin Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "

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

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

2021-02-06 Thread redradist
I mean to be able to do something like this: ```python import asyncio await asyncio.sleep(1); ``` ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/list

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

2021-02-06 Thread Steven D'Aprano
On Sat, Feb 06, 2021 at 10:26:23AM -, redrad...@gmail.com wrote: > Deno is JavaScript runtime that has very nice feature like Top Level > Await, I think it would be also nice to have such feature in Python, > it will make using async/await more convenient > > What do you think ? Share your

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

2021-02-06 Thread redradist
Hi all, Deno is JavaScript runtime that has very nice feature like Top Level Await, I think it would be also nice to have such feature in Python, it will make using async/await more convenient What do you think ? Share your ideas lets discuss ... ___

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

2021-02-06 Thread Chris Angelico
On Sat, Feb 6, 2021 at 8:54 PM Paul Sokolovsky wrote: > > Hello, > > On Sat, 6 Feb 2021 17:26:00 +1100 > Chris Angelico wrote: > > > On Sat, Feb 6, 2021 at 5:21 PM Random832 > > wrote: > > > > > > While we're on the subject of assignment expression limitations, > > > I've occasionally wanted to

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

2021-02-06 Thread Eryk Sun
On 2/6/21, Inada Naoki wrote: > > If adding option to pyvenv.cfg is not make sense, we can add > `python.ini` to same place pyvenv.cfg. i.e., directory containing > python.exe, or one above directory. I'd rather look for "python.cfg" in the directory of the base executable (e.g. "C:\Program Files

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

2021-02-06 Thread Paul Sokolovsky
Hello, On Sat, 6 Feb 2021 17:26:00 +1100 Chris Angelico wrote: > On Sat, Feb 6, 2021 at 5:21 PM Random832 > wrote: > > > > While we're on the subject of assignment expression limitations, > > I've occasionally wanted to write something like > > > > try: > > return a_dict[key] > > except Key

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

2021-02-06 Thread Paul Sokolovsky
Hello, On Sat, 6 Feb 2021 10:46:54 +0200 Serhiy Storchaka wrote: > 05.02.21 09:51, Paul Sokolovsky пише: > > a0 = 0 > > b0 = 10 > > while ((a1, b1) := phi([a0, a2], [b0, b2]))[0] < 5: > > a2 = a1 + 1 > > b2 = b1 + 1 > > Such code quickly becomes unreadable. Especially if in real code

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

2021-02-06 Thread Paul Sokolovsky
Hello, On Sat, 6 Feb 2021 06:17:08 +1100 Chris Angelico wrote: > On Sat, Feb 6, 2021 at 6:08 AM Paul Sokolovsky > wrote: > > And looking back now, that seems like intentionally added accidental > > gap in the language (https://en.wikipedia.org/wiki/Accidental_gap). > > Similar to artificially l

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

2021-02-06 Thread Inada Naoki
On Sat, Feb 6, 2021 at 5:59 AM Eryk Sun wrote: > > > I would have preferred for the py launcher to read and merge settings > for all existing configuration files in the order of > "%ProgramData%\Python\py.ini" (all installations), > "%__AppDir__%\py.ini" (particular installation), and > "%LocalApp