Skip to content

Conversation

DimitriPapadopoulos
Copy link
Contributor

See return-in-generator (B901):

Using return {value} in a generator function was syntactically invalid in Python 2. In Python 3 return {value} can be used in a generator; however, the combination of yield and return can lead to confusing behavior, as the return statement will cause the generator to raise StopIteration with the value provided, rather than returning the value to the caller.

@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as draft October 4, 2024 22:26
@DimitriPapadopoulos DimitriPapadopoulos force-pushed the B901 branch 3 times, most recently from e604413 to e745ac7 Compare October 7, 2024 15:06
@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review October 7, 2024 15:10
@DimitriPapadopoulos DimitriPapadopoulos force-pushed the B901 branch 3 times, most recently from cb33e97 to b1fefcd Compare October 7, 2024 16:20
B901 Using `yield` and `return` in a generator function can lead to confusing behavior

Co-authored-by: Martin Durant <[email protected]>
@martindurant martindurant merged commit f2c7717 into fsspec:master Oct 7, 2024
11 checks passed
@DimitriPapadopoulos DimitriPapadopoulos deleted the B901 branch October 7, 2024 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants