typedecorator icon indicating copy to clipboard operation
typedecorator copied to clipboard

Check for a list containing multiple elements

Open suminb opened this issue 9 years ago • 0 comments

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.

suminb avatar Jun 30 '16 04:06 suminb