3 ms·
I don’t think the new way to write None is an improvement in this case. I use the pipe as a replacement for Union (of which Optional is a special case, but oddl
by diarrhea 3y ago
I don’t think the new way to write None is an improvement in this case. I use the pipe as a replacement for Union (of which Optional is a special case, but oddly, there is prefer to use Optional; it reads nicely).
- kzrdude 3y agoI'm not that deep into type annotations in Python, but I'm not a fan of type-only structures, or mixing concrete with type aliases. That is, `list[T]` is a concrete list, but `Optional[T]` is either a plain T or a plain None. There is no class called Optional.
- rirze 3y agoI prefer the new way, to me it's explicit about the type of Object that can be passed in.