Skip to content

Commit

Permalink
Allow len() with a Tuple argument
Browse files Browse the repository at this point in the history
Fixes #158.
  • Loading branch information
JukkaL committed Jul 13, 2014
1 parent 535ae11 commit 3780b0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mypy/test/data/pythoneval.test
Original file line number Diff line number Diff line change
Expand Up @@ -838,3 +838,9 @@ import typing
'x'.count('x')
'x'.count(u'x')
[out]

[case testLenOfTuple]
import typing
print(len((1, 'x')))
[out]
2
3 changes: 3 additions & 0 deletions stubs/3.2/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,10 @@ def isinstance(o: object, t: tuple) -> bool: pass
def issubclass(cls: type, classinfo: type) -> bool: pass
# TODO perhaps support this
#def issubclass(type cld, classinfo: Sequence[type]) -> bool: pass
@overload
def len(o: Sized) -> int: pass
@overload
def len(o: tuple) -> int: pass
def locals() -> Dict[str, Any]: pass

# TODO more than two iterables
Expand Down

0 comments on commit 3780b0a

Please sign in to comment.