I am attempting to use forward references in my program and I am failing.
This also does not work with the older way of putting the name of a class
as a string. Here is some sample code:
from __future__ import annotations
from dataclasses import dataclass
from typing import TypeAlias
ColorDef: TypeAlias = RGB | int | str
@dataclass(frozen=True, slots=True)
class RGB(object):
Can anyone suggest how I should fix this without reversing the statement
order?
pass
--
Jonathan Gossage
--
https://mail.python.org/mailman/listinfo/python-list
This also does not work with the older way of putting the name of a class
as a string. Here is some sample code:
from __future__ import annotations
from dataclasses import dataclass
from typing import TypeAlias
ColorDef: TypeAlias = RGB | int | str
@dataclass(frozen=True, slots=True)
class RGB(object):
Can anyone suggest how I should fix this without reversing the statement
order?
pass
--
Jonathan Gossage
--
https://mail.python.org/mailman/listinfo/python-list