Skip to content

CSV reader inconsistent with combination of QUOTE_NONNUMERIC and escapechar #113785

Closed
@serhiy-storchaka

Description

@serhiy-storchaka
>>> next(csv.reader([r'2\.5'], escapechar='\\', quoting=csv.QUOTE_NONNUMERIC)) [2.5] >>> next(csv.reader([r'.5'], escapechar='\\', quoting=csv.QUOTE_NONNUMERIC)) [0.5] >>> next(csv.reader([r'\.5'], escapechar='\\', quoting=csv.QUOTE_NONNUMERIC)) ['.5']

It parses numbers with an escaped character in the middle, it parses numbers starting with a dot, but it does not parse numbers starting with an escaped character. The following variants would be more consistent:

  1. Any escaped character disables parsing field as a number.
  2. Allow parsing a field starting with an escaped character as a number.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions