Skip to content

Commit

Permalink
Added comparison-with-callable message example (#6156)
Browse files Browse the repository at this point in the history
Co-authored-by: Vladyslav Krylasov <[email protected]>
Co-authored-by: Pierre Sassoulas <[email protected]>
  • Loading branch information
3 people authored Apr 5, 2022
1 parent ce42d69 commit fe6c0f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/data/messages/c/comparison-with-callable/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def function_returning_a_fruit() -> str:
return "orange"

def is_an_orange(fruit: str = "apple"):
# apple == <function function_returning_a_fruit at 0x7f343ff0a1f0>
return fruit == function_returning_a_fruit # [comparison-with-callable]
6 changes: 6 additions & 0 deletions doc/data/messages/c/comparison-with-callable/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def function_returning_a_fruit() -> str:
return "orange"

def is_an_orange(fruit: str = "apple"):
# apple == orange
return fruit == function_returning_a_fruit()

0 comments on commit fe6c0f2

Please sign in to comment.