[Python-ideas] Re: Make localhost an acceptable parameter to ipaddress.IPv4Address address parameter

2021-09-21 Thread Chris Angelico
On Wed, Sep 22, 2021 at 9:57 AM Andres Torres wrote: > > Title is pretty self explanatory. > > Right the following causes an error: > ```py > >>> ipaddress.IPv4Address('localhost') > Traceback (most recent call last): > File "", line 1, in > File "C:\ProgramData\Anaconda3\lib\ipaddress.py", l

[Python-ideas] Make localhost an acceptable parameter to ipaddress.IPv4Address address parameter

2021-09-21 Thread Andres Torres
Title is pretty self explanatory. Right the following causes an error: ```py >>> ipaddress.IPv4Address('localhost') Traceback (most recent call last): File "", line 1, in File "C:\ProgramData\Anaconda3\lib\ipaddress.py", line 1252, in __init__ self._ip = self._ip_int_from_string(addr_str)

[Python-ideas] Re: Typing Callable Ellipsis -- support for type hints a la Callable[[int, float, ...], None]

2021-09-21 Thread Valentin Berlier
You can do that with a custom protocol https://docs.python.org/3/library/typing.html#typing.Protocol ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/l

[Python-ideas] Typing Callable Ellipsis -- support for type hints a la Callable[[int, float, ...], None]

2021-09-21 Thread Randolf Scholz
Dear Python community, type hinting is awesome! But recently I stumbled upon the following: I was writing a dictionary of functions that all share a common signature, in that the first two arguments were the same type. However, the functions could differ in the remaining arguments (positional /

[Python-ideas] Re: Allow dataclasses's auto-generated __init__ to optionally accept **kwargs and pass them to __post_init_

2021-09-21 Thread thomas . d . mckay
My solution, if anyone comes by here looking for one: from dataclasses import _create_fn def patched_create_fn(name: str, args: list[str], body: list[str], **kwargs): if name == '__init__': args.append('**kwargs') if body == ['pass']: body = [] body.append(