TypeError when using dataclass with default factory for nested list in Python 3.11
I'm building a feature where I keep running into I'm working on a project and hit a roadblock..... I'm trying to create a nested data structure using Python's `dataclass`, where one of the fields is a list of another dataclass. However, I'm working with a `TypeError` when initializing the outer dataclass. Here's what I have: ```python from dataclasses import dataclass, field from typing import List @dataclass class Inner: value: int @dataclass class Outer: items: List[Inner] = field(default_factory=list) # Attempt to create an Outer object outer_instance = Outer(items=[Inner(value=1)]) print(outer_instance) ``` When I run this code snippet, I receive the following behavior: ``` TypeError: want to assign to field 'items' ``` I expected the `items` field to be correctly initialized with a list containing `Inner` instances, but it seems like I'm doing something wrong with the `default_factory`. I've also tried initializing `items` directly without using `default_factory`, but that leads to an empty list when I do not provide any items on initialization. Is there an scenario with how I'm using the `default_factory` or something else I'm missing? I've read the [dataclass documentation](https://docs.python.org/3/library/dataclasses.html) and it suggests that this approach should work, so Iām a bit exploring on how to resolve this. Has anyone else encountered this? This is my first time working with Python LTS. Any feedback is welcome! The stack includes Python and several other technologies. Am I missing something obvious?