[issue47166] Dataclass transform should ignore TypeAlias variables

2022-04-06 Thread Thomas MK
Thomas MK added the comment: There is of course no hard reason for not using the global scope. I just often have enums (or other types) that are very closely linked to one class. And it makes sense to me then to have a TypeAlias in that class so that I don't have to import the enum

[issue47166] Dataclass transform should ignore TypeAlias variables

2022-03-31 Thread Eric V. Smith
Eric V. Smith added the comment: Same question as Alex: what does the TypeAlias being inside the class offer that being at module level doesn't? -- ___ Python tracker ___

[issue47166] Dataclass transform should ignore TypeAlias variables

2022-03-31 Thread Alex Waygood
Alex Waygood added the comment: I think implementing this would add complexity to the code in dataclasses.py (though Eric's the expert!). For your use case, is it essential that the type alias declaration be inside the class scope? Would it be possible for you to simply have the alias

[issue47166] Dataclass transform should ignore TypeAlias variables

2022-03-30 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: >From a typing perspective this is reasonable. See this thread about type >aliases in class scopes: >https://mail.python.org/archives/list/typing-...@python.org/thread/CGOO7GPPECGMLFDUDXSSXTRADI4BXYCS/ > However, it's a niche use case and we could decide

[issue47166] Dataclass transform should ignore TypeAlias variables

2022-03-30 Thread Jelle Zijlstra
Change by Jelle Zijlstra : -- nosy: +AlexWaygood, GBeauregard, JelleZijlstra ___ Python tracker ___ ___ Python-bugs-list mailing

[issue47166] Dataclass transform should ignore TypeAlias variables

2022-03-30 Thread Ned Deily
Change by Ned Deily : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue47166] Dataclass transform should ignore TypeAlias variables

2022-03-30 Thread Thomas MK
New submission from Thomas MK : The dataclass transformation ignores attributes that are annotated as ClassVar. I think it should also ignore attributes that are annotated as TypeAlias. Specifically, I have this usecase in mind: class RunMode(Enum): release = auto() debug = auto()