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
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)
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
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 /
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(