Skip to content

Check for a list containing multiple elements #12

@suminb

Description

@suminb

I understand a list containing a single element can be checked as the document states as follows:

A list containing a single element, requiring that the value be a list of values, all matching the type signature of that element. For example, a type signature specifying a list of integers would be [int].

I was wondering if it is possible to check for a list containing multiple elements. For example, if a function expects a 2D coordinate, it would require the following type:

[int, int]

More precisely, I would like to check for the following type:

typedecorator.Union((int, int), [int, int])

but that does not seem possible as I'm getting TypeError: Invalid type signature. If I change my code a bit like:

typedecorator.Union((int, int), list)

it seems working okay but that's not quite what I want.

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