[issue46549] Error in list comprehension conditionals when used in class attributes

2022-01-27 Thread Dennis Sweeney
Dennis Sweeney added the comment: See also https://stackoverflow.com/questions/13905741/accessing-class-variables-from-a-list-comprehension-in-the-class-definition -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python t

[issue46549] Error in list comprehension conditionals when used in class attributes

2022-01-27 Thread Dennis Sweeney
Dennis Sweeney added the comment: I believe this is a duplicate of bpo-45899 -- nosy: +Dennis Sweeney ___ Python tracker ___ ___ Py

[issue46549] Error in list comprehension conditionals when used in class attributes

2022-01-27 Thread din14970
New submission from din14970 : I discovered this one by accident. When using a conditional inside a list comprehension in class attributes one can get some unexpected behavior. The following does not work: ``` class TestClass: list_1 = [1, 2, 3, 4, 5] exclude = [2, 4] list_2 = [i