Closed wipascal closed 2 years ago
Okay, a lot of comments, I think some of the issues might also originate from when I wrote annotations the first time. Another thing I wonder is: Could it make sense that we implement our own type (see https://docs.python.org/3/library/typing.html#user-defined-generic-types) for the cases where we use
htmlgenerator.Lazy
? I hope we could writeLazy[str]
orLazy[Any]
and similar instead of always skipping or usingUnion
.1. We express the expected type of the Lazy expression 2. No need to always think the "non-lazy" option.
I like the idea of introducing "shortcuts" for the types. They can get very verbose...
But
Lazy[str]
to me just looks like a Lazy that evaluates to a string and not likeUnion[Lazy, str]
. For me we would need to call itMaybeLazy[str]
or something like that.(Actually I like the idea of using
Lazy[T]
for a Lazy that evaluates to T, but that's a different topic altogether.)
Right, MaybeLazy[T]
and Lazy[T]
would be interesting, if somebody needs something recreational to do, that could be added in htmlgenerator ;)
I like the idea of introducing "shortcuts" for the types. They can get very verbose...
But
Lazy[str]
to me just looks like a Lazy that evaluates to a string and not likeUnion[Lazy, str]
. For me we would need to call itMaybeLazy[str]
or something like that.(Actually I like the idea of using
Lazy[T]
for a Lazy that evaluates to T, but that's a different topic altogether.)