Closed as not planned
Description
Feature or enhancement
Optimize out an empty/one-element constant unpack into a set, which currently output these bytecodes:
>>> from dis import dis
>>> dis("{*()}")
0 RESUME 0
1 2 BUILD_SET 0
4 LOAD_CONST 0 (())
6 SET_UPDATE 1
8 RETURN_VALUE
>>> dis("{*(1,)}")
0 RESUME 0
1 2 BUILD_SET 0
4 LOAD_CONST 0 ((1,))
6 SET_UPDATE 1
8 RETURN_VALUEPitch
Add a check for constants in the set case in Python/ast_opt.c and apply optimizations if the constant is a sequence and the size is 0 or 1.
Previous discussion
N/A

