python - Is it a good habit to print the bool value from a function? -
def f(): return true print(f())
or
def f(): return true if f(): print('true') else: print('false')
should round in if statement or print out value, in python 3.3.2?
print
automatically converts input string representation. so, 2 methods exact same thing. considering that, why not use first? lot cleaner.
also, second method can simplified:
print('true' if f() else 'false')
having code simple isn't necessary.
Comments
Post a Comment