---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/valid/expressions/set.py
---
## AST

```
Module(
    ModModule {
        range: 0..313,
        body: [
            Expr(
                StmtExpr {
                    range: 14..16,
                    value: Dict(
                        ExprDict {
                            range: 14..16,
                            keys: [],
                            values: [],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 17..20,
                    value: Set(
                        ExprSet {
                            range: 17..20,
                            elts: [
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 18..19,
                                        value: Int(
                                            1,
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 21..25,
                    value: Set(
                        ExprSet {
                            range: 21..25,
                            elts: [
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 22..23,
                                        value: Int(
                                            1,
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 26..35,
                    value: Set(
                        ExprSet {
                            range: 26..35,
                            elts: [
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 27..28,
                                        value: Int(
                                            1,
                                        ),
                                    },
                                ),
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 30..31,
                                        value: Int(
                                            2,
                                        ),
                                    },
                                ),
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 33..34,
                                        value: Int(
                                            3,
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 36..46,
                    value: Set(
                        ExprSet {
                            range: 36..46,
                            elts: [
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 37..38,
                                        value: Int(
                                            1,
                                        ),
                                    },
                                ),
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 40..41,
                                        value: Int(
                                            2,
                                        ),
                                    },
                                ),
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 43..44,
                                        value: Int(
                                            3,
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 74..77,
                    value: Dict(
                        ExprDict {
                            range: 74..77,
                            keys: [],
                            values: [],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 78..91,
                    value: Set(
                        ExprSet {
                            range: 78..91,
                            elts: [
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 88..89,
                                        value: Int(
                                            1,
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 92..113,
                    value: Set(
                        ExprSet {
                            range: 92..113,
                            elts: [
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 98..99,
                                        value: Int(
                                            1,
                                        ),
                                    },
                                ),
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 109..110,
                                        value: Int(
                                            2,
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 124..129,
                    value: Set(
                        ExprSet {
                            range: 124..129,
                            elts: [
                                Set(
                                    ExprSet {
                                        range: 125..128,
                                        elts: [
                                            NumberLiteral(
                                                ExprNumberLiteral {
                                                    range: 126..127,
                                                    value: Int(
                                                        1,
                                                    ),
                                                },
                                            ),
                                        ],
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 130..146,
                    value: Set(
                        ExprSet {
                            range: 130..146,
                            elts: [
                                Set(
                                    ExprSet {
                                        range: 131..137,
                                        elts: [
                                            NumberLiteral(
                                                ExprNumberLiteral {
                                                    range: 132..133,
                                                    value: Int(
                                                        1,
                                                    ),
                                                },
                                            ),
                                            NumberLiteral(
                                                ExprNumberLiteral {
                                                    range: 135..136,
                                                    value: Int(
                                                        2,
                                                    ),
                                                },
                                            ),
                                        ],
                                    },
                                ),
                                Set(
                                    ExprSet {
                                        range: 139..145,
                                        elts: [
                                            NumberLiteral(
                                                ExprNumberLiteral {
                                                    range: 140..141,
                                                    value: Int(
                                                        3,
                                                    ),
                                                },
                                            ),
                                            NumberLiteral(
                                                ExprNumberLiteral {
                                                    range: 143..144,
                                                    value: Int(
                                                        4,
                                                    ),
                                                },
                                            ),
                                        ],
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 167..175,
                    value: Set(
                        ExprSet {
                            range: 167..175,
                            elts: [
                                Named(
                                    ExprNamed {
                                        range: 168..174,
                                        target: Name(
                                            ExprName {
                                                range: 168..169,
                                                id: "x",
                                                ctx: Store,
                                            },
                                        ),
                                        value: NumberLiteral(
                                            ExprNumberLiteral {
                                                range: 173..174,
                                                value: Int(
                                                    2,
                                                ),
                                            },
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 176..190,
                    value: Set(
                        ExprSet {
                            range: 176..190,
                            elts: [
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 177..178,
                                        value: Int(
                                            1,
                                        ),
                                    },
                                ),
                                Named(
                                    ExprNamed {
                                        range: 180..186,
                                        target: Name(
                                            ExprName {
                                                range: 180..181,
                                                id: "x",
                                                ctx: Store,
                                            },
                                        ),
                                        value: NumberLiteral(
                                            ExprNumberLiteral {
                                                range: 185..186,
                                                value: Int(
                                                    2,
                                                ),
                                            },
                                        ),
                                    },
                                ),
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 188..189,
                                        value: Int(
                                            3,
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 191..205,
                    value: Set(
                        ExprSet {
                            range: 191..205,
                            elts: [
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 192..193,
                                        value: Int(
                                            1,
                                        ),
                                    },
                                ),
                                Named(
                                    ExprNamed {
                                        range: 196..202,
                                        target: Name(
                                            ExprName {
                                                range: 196..197,
                                                id: "x",
                                                ctx: Store,
                                            },
                                        ),
                                        value: NumberLiteral(
                                            ExprNumberLiteral {
                                                range: 201..202,
                                                value: Int(
                                                    2,
                                                ),
                                            },
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 225..235,
                    value: Set(
                        ExprSet {
                            range: 225..235,
                            elts: [
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 226..227,
                                        value: Int(
                                            1,
                                        ),
                                    },
                                ),
                                Starred(
                                    ExprStarred {
                                        range: 229..231,
                                        value: Name(
                                            ExprName {
                                                range: 230..231,
                                                id: "x",
                                                ctx: Load,
                                            },
                                        ),
                                        ctx: Load,
                                    },
                                ),
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 233..234,
                                        value: Int(
                                            3,
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 236..250,
                    value: Set(
                        ExprSet {
                            range: 236..250,
                            elts: [
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 237..238,
                                        value: Int(
                                            1,
                                        ),
                                    },
                                ),
                                Starred(
                                    ExprStarred {
                                        range: 240..246,
                                        value: BinOp(
                                            ExprBinOp {
                                                range: 241..246,
                                                left: Name(
                                                    ExprName {
                                                        range: 241..242,
                                                        id: "x",
                                                        ctx: Load,
                                                    },
                                                ),
                                                op: BitOr,
                                                right: Name(
                                                    ExprName {
                                                        range: 245..246,
                                                        id: "y",
                                                        ctx: Load,
                                                    },
                                                ),
                                            },
                                        ),
                                        ctx: Load,
                                    },
                                ),
                                NumberLiteral(
                                    ExprNumberLiteral {
                                        range: 248..249,
                                        value: Int(
                                            3,
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    range: 273..312,
                    value: Set(
                        ExprSet {
                            range: 273..312,
                            elts: [
                                BinOp(
                                    ExprBinOp {
                                        range: 274..279,
                                        left: NumberLiteral(
                                            ExprNumberLiteral {
                                                range: 274..275,
                                                value: Int(
                                                    1,
                                                ),
                                            },
                                        ),
                                        op: Add,
                                        right: NumberLiteral(
                                            ExprNumberLiteral {
                                                range: 278..279,
                                                value: Int(
                                                    2,
                                                ),
                                            },
                                        ),
                                    },
                                ),
                                Tuple(
                                    ExprTuple {
                                        range: 281..287,
                                        elts: [
                                            Name(
                                                ExprName {
                                                    range: 282..283,
                                                    id: "a",
                                                    ctx: Load,
                                                },
                                            ),
                                            Name(
                                                ExprName {
                                                    range: 285..286,
                                                    id: "b",
                                                    ctx: Load,
                                                },
                                            ),
                                        ],
                                        ctx: Load,
                                        parenthesized: true,
                                    },
                                ),
                                Set(
                                    ExprSet {
                                        range: 289..298,
                                        elts: [
                                            NumberLiteral(
                                                ExprNumberLiteral {
                                                    range: 290..291,
                                                    value: Int(
                                                        1,
                                                    ),
                                                },
                                            ),
                                            NumberLiteral(
                                                ExprNumberLiteral {
                                                    range: 293..294,
                                                    value: Int(
                                                        2,
                                                    ),
                                                },
                                            ),
                                            NumberLiteral(
                                                ExprNumberLiteral {
                                                    range: 296..297,
                                                    value: Int(
                                                        3,
                                                    ),
                                                },
                                            ),
                                        ],
                                    },
                                ),
                                Dict(
                                    ExprDict {
                                        range: 300..311,
                                        keys: [
                                            Some(
                                                Name(
                                                    ExprName {
                                                        range: 301..302,
                                                        id: "a",
                                                        ctx: Load,
                                                    },
                                                ),
                                            ),
                                            None,
                                        ],
                                        values: [
                                            Name(
                                                ExprName {
                                                    range: 304..305,
                                                    id: "b",
                                                    ctx: Load,
                                                },
                                            ),
                                            Name(
                                                ExprName {
                                                    range: 309..310,
                                                    id: "d",
                                                    ctx: Load,
                                                },
                                            ),
                                        ],
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
        ],
    },
)
```
