Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit 63f4710

Browse files
committed
tests/cpydiff: Add difference-test for second arg of builtin next().
1 parent 7cf446f commit 63f4710

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/cpydiff/builtin_next_arg2.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""
2+
categories: Modules,builtins
3+
description: Second argument to next() is not implemented
4+
cause: MicroPython is optimised for code space.
5+
workaround: Instead of `val = next(it, deflt)` use::
6+
7+
try:
8+
val = next(it)
9+
except StopIteration:
10+
val = deflt
11+
"""
12+
print(next(iter(range(0)), 42))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy