New submission from Doug Hoskisson <bea...@gmail.com>:

I'm running into an issue with the syntax of 
https://www.python.org/dev/peps/pep-0589/

```
class C(TypedDict):
    to: int
    from: int
        
SyntaxError: invalid syntax
```

I'm not sure any change needs to be made to the specification.
But the interpreter needs to recognize that `from` is a string key to a 
`TypedDict`, not the keyword `from`.

Or if you don't want to have to recognize `from` as a string instead of a 
keyword, we need a specification that allows us to put keywords as keys in 
`TypedDict`.

I was thinking maybe something like:
```
class C(TypedDict):
        "to": int
        "from": int
```
as an optional way to write the same thing.

----------
messages: 399595
nosy: Doug Hoskisson
priority: normal
severity: normal
status: open
title: Python keywords as string keys in TypedDict
type: behavior
versions: Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44915>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to