Skip to content

Documentation inaccurately describes "letter" #59

Open
@mcclure

Description

@mcclure

In general, Parsley seems to not be very aware of Unicode. A specific manifestation of this problem, the documentation says:

letter:
    Matches a single ASCII letter.

However, looking at the source code, I think it is doing something different. Looking at runtime.py, the class OMetaBase, the method letter() is implemented by calling str.isalpha(). The Python documentation describes isalpha as:
Python 2.7: Depends on locale
Python 3.5: Union of several Unicode categories

In other words, unless I am misunderstanding the source, the characters matched by letter will depend on version of Python and in version 2.7 will depend on locale. This should be documented.

ws and digit have similar problems, btw. The ws documentation says it "matches zero or more spaces, tabs, or newlines" but the implementation in the source appears to use str.isspace(), which has similar behavior to isalpha.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions