I'm thinking about how to get it right.
Currently our lazy functions just returning str, and I think about changing that to class StrPromise(Promise, str): ...
There's some problems with that, but it's better than plain str, and least disruptive. E.q. we don't need to change much code.
It allows us to catch places where we expect StrPromise, but getting str.
class Promise: ...
class StrPromise(Promise, str): ...
def gettext_lazy(v: str) -> StrPromise: ...
v1: StrPromise = StrPromise()
# Error
v2: StrPromise = ""
# Both cases ok
v3: str = ""
v4: str = StrPromise()
@sbdchd what do you think?
I'm thinking about how to get it right.
Currently our lazy functions just returning
str, and I think about changing that toclass StrPromise(Promise, str): ...There's some problems with that, but it's better than plain str, and least disruptive. E.q. we don't need to change much code.
It allows us to catch places where we expect StrPromise, but getting str.
@sbdchd what do you think?