Wilfredo Sánchez Vega
Wilfredo Sánchez Vega
I'm not sure I agree that the optional type indicates that the default should be `None`; it only indicates that the value may be `None`. That said, it does seem...
I think that if we did that, we should have an `attrs.dataclass` namespace, rather than using the primary namespace. The reason for that is that if we start down that...
Note that with type annotations, `instance_of` is a partial solution, since we'll also see people trying interface types: ```python @attr.s @validate_attr_types class Foo: bar : AnyStr bat : Optional[float] baz...
(Excellent write-up, by the way.)
Yeah… this isn't `attrs`.
Ah, let's re-open for consideration in the docs.
Does it work if you write it as `acme = Factory(typed)`?
(That said, I'd probably go with `@attr.define` and use `acme: str = typed()`.)
Hrm… I'm getting a different result: ``` wsanchez$ python3.9 -m venv test ``` ``` wsanchez$ ./test/bin/pip install -q attrs mypy ``` ``` wsanchez$ ./test/bin/pip freeze attrs==20.3.0 mypy==0.812 mypy-extensions==0.4.3 typed-ast==1.4.2 typing-extensions==3.7.4.3...
Ah wait, you said that does work, but only with `auto_attribs=True`.