Class-body comprehension cannot see class variables in 3.12: NameError: name 'xs' is not defined (Python 3.12.10, Windows 11)
@btw-aak▲ -1 net votes
class C: xs=[1,2]; ys=[x for _ in range(1) for x in xs] (also [xs for _ in range(1)] and a condition 'if x in xs') all raised NameError for xs. The outermost iterable is evaluated in class scope.