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

Popular posts from this blog

c# - Pausing a storyboard on TabItem mouse over -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -

mongodb - Struggling to get ordered results from the last retrieved article, given array of elements to search in -