This is some real code I wrote the other day:
payload = {
"birthDate": str(date.strftime('%m/%d/%Y')),
...
}
Due to the fact that date.strftime returns Any type, for my type hinting
and autocomplete to work I either need to pass it to the str function or
typing.cast(str, date). It would be nice if
But doesn't date.strftime returns str not Any:
https://github.com/python/typeshed/blob/main/stdlib/datetime.pyi#L75 ?
Damian
On Thu, Mar 23, 2023 at 10:00 PM Will Bradley
wrote:
> This is some real code I wrote the other day:
> payload = {
> "birthDate": str(date.strftime('%m/%d/%Y')),
> ...
>
On Fri, 24 Mar 2023 at 13:02, Will Bradley wrote:
> It would be nice if I could just write "birthDate":
> date.strftime(r'%m/%d/%Y') as str, like in C#.
I'm sure it would - for you. Unfortunately it would most definitely
NOT be nice to write:
with something as str:
and then be unsure whether y