Files
pydantic/docs/examples/postponed_broken.py
T
Samuel Colvin 1161df3ca0 support ForwardRef on dataclasses (#399)
* support ForwardRef on dataclasses, fix #397

* explicit docs about when postponed annotations don't work
2019-02-18 08:41:35 +00:00

9 lines
275 B
Python

from __future__ import annotations
from pydantic import BaseModel
def this_is_broken():
from typing import List # <-- List is defined inside the function so is not in the module's global scope
class Model(BaseModel):
a: List[int]
print(Model(a=(1, 2)))