Skip to content

synt.tokens.keywords ¤

hard_keywords module-attribute ¤

hard_keywords = kwlist

All Python's hard keywords, in string format.

Alias for std library's keyword.kwlist.

soft_keywords module-attribute ¤

soft_keywords = softkwlist

All Python's soft keywords, in string format.

Alias for std library's keyword.softkwlist.

is_hard_keyword ¤

is_hard_keyword(i: str) -> bool

Check if a string is a hard keyword.

See hard_keywords for more information.

Parameters:

Name Type Description Default
i str

The string to check.

required
Source code in synt/tokens/keywords.py
def is_hard_keyword(i: str) -> bool:
    r"""Check if a string is a hard keyword.

    See [`hard_keywords`][synt.tokens.keywords.hard_keywords] for more information.

    Args:
        i: The string to check.
    """
    return keyword.iskeyword(i)

is_soft_keyword ¤

is_soft_keyword(i: str) -> bool

Check if a string is a soft keyword.

See soft_keywords for more information.

Parameters:

Name Type Description Default
i str

The string to check.

required
Source code in synt/tokens/keywords.py
def is_soft_keyword(i: str) -> bool:
    r"""Check if a string is a soft keyword.

    See [`soft_keywords`][synt.tokens.keywords.soft_keywords] for more information.

    Args:
        i: The string to check.
    """
    return keyword.issoftkeyword(i)