New submission from Weijar Z <weij...@gmail.com>:

This express 

  f"{x}{x}{y}"

will produce ast tree:

{
    "$node": "Module",
    "body": [
        {
            "$node": "Expr",
            "value": {
                "$node": "JoinedStr",
                "values": [
                    {
                        "$node": "FormattedValue",
                        "value": {
                            "$node": "Name",
                            "id": "x",
                            "ctx": {
                                "$node": "Load"
                            },
                            "lineno": 1,
                            "col_offset": 3
                        },
                        "conversion": -1,
                        "format_spec": null,
                        "lineno": 1,
                        "col_offset": 0
                    },
                    {
                        "$node": "FormattedValue",
                        "value": {
                            "$node": "Name",
                            "id": "x",
                            "ctx": {
                                "$node": "Load"
                            },
                            "lineno": 1,
                            "col_offset": 3
                        },
                        "conversion": -1,
                        "format_spec": null,
                        "lineno": 1,
                        "col_offset": 0
                    },
                    {
                        "$node": "FormattedValue",
                        "value": {
                            "$node": "Name",
                            "id": "y",
                            "ctx": {
                                "$node": "Load"
                            },
                            "lineno": 1,
                            "col_offset": 9
                        },
                        "conversion": -1,
                        "format_spec": null,
                        "lineno": 1,
                        "col_offset": 0
                    }
                ],
                "lineno": 1,
                "col_offset": 0
            },
            "lineno": 1,
            "col_offset": 0
        }
    ]
}

These two variable 'x' has same col_offset '3', is it wrong?

----------
components: Library (Lib)
messages: 346950
nosy: Weijar Z
priority: normal
severity: normal
status: open
title: ast: Different FormattedValue expressions have same col_offset 
information
type: behavior
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37458>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to