[Python-Dev] a name for the ExceptHandler.type when it is a literal tuple of types

2021-05-08 Thread Thomas Grainger
That's this bit: ``` except (A, B): ^^ ``` bpo-43149 currently calls it an "exception group", but that conflicts with PEP 654 -- Exception Groups and except* ``` >>> try: ... pass ... except A, B: ... pass Traceback (most recent call last): SyntaxError:

[Python-Dev] Re: a name for the ExceptHandler.type when it is a literal tuple of types

2021-05-08 Thread Thomas Grainger
There's a PR to use "SyntaxError: multiple exception types must be parenthesized" https://github.com/python/cpython/pull/25996 On Sat, 8 May 2021, 19:20 Gregory P. Smith, wrote: > > > On Sat, May 8, 2021 at 8:54 AM Thomas Grainger wrote: > >> That's t

[Python-Dev] Re: a name for the ExceptHandler.type when it is a literal tuple of types

2021-05-08 Thread Thomas Grainger
ame as for isinstance() and issubclass().) > > On Sat, May 8, 2021 at 05:52 Thomas Grainger wrote: > >> That's this bit: >> >> ``` >> except (A, B): >>^^ >> ``` >> >> bpo-43149 currently calls it an "exception

[Python-Dev] Re: a name for the ExceptHandler.type when it is a literal tuple of types

2021-05-10 Thread Thomas Grainger
I opened a new thread here: https://mail.python.org/archives/list/python-id...@python.org/thread/WQOMBT4Z22EIFB53WN54E52AYS3QBKAV/ ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://ma

[Python-Dev] Re: python-iterators mailing list on SourceForge

2021-05-11 Thread Thomas Grainger
it might be possible to recover the account by contacting sfnet_...@slashdotmedia.com ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.pyth

[Python-Dev] Re: Implementing async enumerate

2021-05-30 Thread Thomas Grainger
https://aiostream.readthedocs.io/en/stable/operators.html#aiostream.stream.enumerate Is a nice version of an async enumerate. It also handles aclosing ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@p

[Python-Dev] Re: Delayed evaluation of f-strings?

2021-06-24 Thread Thomas Grainger
for your usecase I'd write: def delayed_fstring(*, name: str) -> str: return "The current name is {name}" def new_scope() -> None: for name in ["foo", "bar"]: print(delayed_fstring(name=name)) for logging I use: class Msg: def __init__(self, fn: Callable[[], str]):

[Python-Dev] Re: [slightly OT] cryptographically strong random.SystemRandom()

2021-07-12 Thread Thomas Grainger
https://docs.microsoft.com/en-us/windows/win32/seccng/cng-portal ? On Mon, 12 Jul 2021, 23:18 Dan Stromberg, wrote: > > On Mon, Jul 12, 2021 at 8:37 AM Steve Dower > wrote: > >> On 7/12/2021 4:11 PM, Dan Stromberg wrote: >> > It looks like CPython could do better on Windows: SystemRandom (becau

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-10 Thread Thomas Grainger
dataclasses need to check for ClassVar ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-10 Thread Thomas Grainger
get the > real type once it is defined? Wouldn't that then allow users to write code > that allows for all use cases under this scenario? > - Damian (he/him) > On Tue, Aug 10, 2021 at 1:55 PM Thomas Grainger tagr...@gmail.com wrote: > > dataclasses need to check for ClassVar &

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-10 Thread Thomas Grainger
Although the co_annoations code could intercept the NameError and replace return a ForwardRef object instead of the resolved name ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mai

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-10 Thread Thomas Grainger
Jelle Zijlstra wrote: > El mar, 10 ago 2021 a las 11:20, Thomas Grainger (tagr...@gmail.com) > escribió: > > Although the co_annoations code could intercept the NameError and replace > > return a ForwardRef object instead of the resolved name > > I implemented a ve

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-10 Thread Thomas Grainger
What about using a coroutine of `v = yield (name, scope)` so the caller can choose how and when names are resolved? ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/m

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-11 Thread Thomas Grainger
I think as long as there's a test case for something like ``` @dataclass class Node: global_node: ClassVar[Node | None] left: InitVar[Node | None] right: InitVar[None | None] ``` the bug https://bugs.python.org/issue33453 and the current implementation https://github.com/python/cpyth

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-11 Thread Thomas Grainger
Larry Hastings wrote: > On 8/11/21 12:02 AM, Thomas Grainger wrote: > > I think as long as there's a test case for something like > > @dataclass > > class Node: > > global_node: ClassVar[Node | None] > > left: InitVar[Node | None] > >

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-11 Thread Thomas Grainger
Larry Hastings wrote: > On 8/11/21 2:48 AM, Jukka Lehtosalo wrote: > > On Wed, Aug 11, 2021 at 10:32 AM Thomas Grainger > mailto:tagr...@gmail.com> wrote: > > Larry Hastings wrote: > > > On 8/11/21 12:02 AM, Thomas Grainger wrote: > > > > I think as long

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-11 Thread Thomas Grainger
Would: ``` @dataclass class Node: global_node: __class__ | None ``` "Just work" with co_annotations? ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lis

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-11 Thread Thomas Grainger
I don't think I've seen code like this. It would be incredibly useful to have a cpython-primer (like mypy-primer and black-primer) that ran as many test suites as possible from pypi with every cPython commit ___ Python-Dev mailing list -- python-dev@pyt

[Python-Dev] Re: Regressions caused the recent work on ceval.c and frame objects

2021-09-19 Thread Thomas Grainger
Are projects that ship pre-compiled wheels impacted? Eg twisted-iocpsupport ? On Sun, 19 Sep 2021, 22:09 Miro Hrončok, wrote: > On 19. 09. 21 21:34, dw-...@d-woods.co.uk wrote: > > Are you sure Cython is still broken? It looks like it was fixed back in > May (https://github.com/cython/cython/iss

[Python-Dev] Re: f-strings in the grammar

2021-09-20 Thread Thomas Grainger
I don't think the python syntax should be beholden to syntax highlighting tools, eventually some syntax feature that PEG enables will require every parser or highlighter to switch to a similar or more powerful parse tool ___ Python-Dev mailing list -- p

[Python-Dev] Re: Does ensurepip still have to include a copy of setuptools?

2021-10-02 Thread Thomas Grainger
I raised an issue about this: https://github.com/pypa/pip/issues/10530 ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message a

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Thomas Grainger
What about `except case ExceptionGroup[E1 | E2]:`? and use match semantics? On Sun, 3 Oct 2021, 16:50 Irit Katriel via Python-Dev, < python-dev@python.org> wrote: > > We wonder if people have a view on which of the following is > clearer/better: > > 1. except *E as e: // except *(E1, E2) as e:

[Python-Dev] Re: Worried about Python release schedule and lack of stable C-API

2021-10-05 Thread Thomas Grainger
I think that's unfortunate, you can still use and format the subset of Python 3.10 syntax with black. You already do this on python 3.9 for example black doesn't support parenthesized with ___ Python-Dev mailing list -- python-dev@python.org To unsubsc

[Python-Dev] Re: PEP 654 except* formatting

2021-10-06 Thread Thomas Grainger
How about ``` try: ... exceptgroup E1, E2: ... `` ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at h

[Python-Dev] Re: Python multithreading without the GIL

2021-10-11 Thread Thomas Grainger
Is D1.update(D2) still atomic with this implementation? https://docs.python.org/3.11/faq/library.html#what-kinds-of-global-value-mutation-are-thread-safe On Mon, 11 Oct 2021, 17:54 Sam Gross, wrote: > On Fri, Oct 8, 2021 at 12:04 PM Nathaniel Smith wrote: > >> I notice the fb.com address -- is

[Python-Dev] Re: Python multithreading without the GIL

2021-10-11 Thread Thomas Grainger
I have a PR to remove this FAQ entry: https://github.com/python/cpython/pull/28886 ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.o

[Python-Dev] Re: Oh look, I've been subscribed to python/issues-test-2 notifications again

2021-11-04 Thread Thomas Grainger
I was looking into migrating twisted trac to github, and contacted GitHub support who told me there's a secret API that doesn't notify subscribers https://gist.github.com/jonmagic/5282384165e0f86ef105 On Thu, 4 Nov 2021, 19:28 Brett Cannon, wrote: > What notification? (I fully admit I may not ha

[Python-Dev] Re: Decreasing refcount for locals before popping frame

2022-04-28 Thread Thomas Grainger
Can you show a run-able example of the successful and unsuccessful usage of `with DAG(): ... `? On Fri, Apr 29, 2022, 6:31 AM Malthe wrote: > Pablo Galindo Salgado wrote: > > As it has been mentioned there is no guarantee that your variable will > even > > be finalized (or even destroyed) after

[Python-Dev] Re: Decreasing refcount for locals before popping frame

2022-04-29 Thread Thomas Grainger
t any that are missing from the globals of the module On Fri, Apr 29, 2022, 7:45 AM Malthe wrote: > On Fri, 29 Apr 2022 at 06:38, Thomas Grainger wrote: > > Can you show a run-able example of the successful and unsuccessful usage > of `with DAG(): ... `? > > from airflow i

[Python-Dev] Re: Decreasing refcount for locals before popping frame

2022-04-29 Thread Thomas Grainger
Can you ping me on the airflow PR for this change? (@graingert) On Fri, Apr 29, 2022, 7:54 AM Malthe wrote: > On Fri, 29 Apr 2022 at 06:50, Thomas Grainger wrote: > > You can use a `__del__` method that warns on collection - like an > unawaited coroutine > > > > Also