You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
typing.NamedTuple should accept unicode names #2761
Just to be clear, there is no such thing as an AnyStr value, since AnyStr is a type variable.
Ah, good to know. I was sure that AnyStr is just an alias for Union[str, unicode] but apparently I was wrong.
I think in this particular case AnyStr should work just fine for most real world scenarios: NamedTuple is used in a "static" way with string literals and people use either bytestring literals or unicode literals without mixing the two. Nevertheless, Union[str, unicode] is obviously more general so I have fixed the code.
Activity
Make `NamedTuple` accept `AnyStr` names (python#2761).
[-]`typing.NamedTuple` should accept `AnyStr` names[/-][+]`typing.NamedTuple` should accept `unicode` names[/+]JelleZijlstra commentedon Jan 23, 2019
Thanks for the report and fix!
Just to be clear, there is no such thing as an AnyStr value, since AnyStr is a type variable.
panhania commentedon Jan 23, 2019
Ah, good to know. I was sure that
AnyStris just an alias forUnion[str, unicode]but apparently I was wrong.I think in this particular case
AnyStrshould work just fine for most real world scenarios:NamedTupleis used in a "static" way with string literals and people use either bytestring literals or unicode literals without mixing the two. Nevertheless,Union[str, unicode]is obviously more general so I have fixed the code.Make `NamedTuple` accept `Text` names (#2762)