typing: property/setter and lists? [RESOLVED]

Chris Angelico rosuav at gmail.com
Thu Nov 3 14:16:59 EDT 2022


On Fri, 4 Nov 2022 at 05:03, Paulo da Silva
<p_d_a_s_i_l_v_a_ns at nonetnoaddress.pt> wrote:
> Changing def foos(self) -> list[int]:  to
>   def foos(self) -> Union[list[int]]:
> fixes the problem.
> Not so elegant, however!

Wait, what?!

Union[X, Y] means "X or Y"
Union[X] means "X, but don't complain if it's a @property".

Is that how it goes?

ChrisA


More information about the Python-list mailing list