norminette
This commit is contained in:
@@ -4,19 +4,25 @@ def NULL_not_found(object: any) -> int:
|
||||
match object:
|
||||
case None:
|
||||
print("Nothing:", object, nullType)
|
||||
# using a guard https://docs.python.org/3/reference/compound_stmts.html#guards
|
||||
# (NaN == NaN) = false https://docs.python.org/3.10/reference/expressions.html#value-comparisons "A counter-intuitive implication is that not-a-number values are not equal to themselves"
|
||||
|
||||
# using a guard :
|
||||
# https://docs.python.org/3/reference/compound_stmts.html#guards
|
||||
# (NaN == NaN) = false :
|
||||
# https://docs.python.org/3.10/reference/expressions.html#value-comparisons
|
||||
# "A counter-intuitive implication is that not-a-number values are not
|
||||
# equal to themselves"
|
||||
|
||||
case float() if object != object:
|
||||
print("Cheese:", object, nullType)
|
||||
# need check before int(), why ?
|
||||
case bool() if object == False :
|
||||
case bool() if object is False:
|
||||
print("Fake:", object, nullType)
|
||||
case int() if object == 0 :
|
||||
case int() if object == 0:
|
||||
print("Zero:", object, nullType)
|
||||
case str() if object == '' :
|
||||
case str() if object == '':
|
||||
print("Empty:", nullType)
|
||||
case _:
|
||||
print("Type not Found")
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
return 0
|
||||
|
||||
@@ -4,7 +4,7 @@ Nothing = None
|
||||
Garlic = float("NaN")
|
||||
Garlic2 = float("2")
|
||||
Zero = 0
|
||||
Empty = '' # ’’
|
||||
Empty = '' # ’’
|
||||
Fake = False
|
||||
Right = True
|
||||
|
||||
@@ -18,4 +18,4 @@ print(NULL_not_found("Brian"))
|
||||
print("--")
|
||||
NULL_not_found(Garlic2)
|
||||
NULL_not_found(Right)
|
||||
print(NULL_not_found(""))
|
||||
print(NULL_not_found(""))
|
||||
|
||||
Reference in New Issue
Block a user