Nov-13-2016, 08:57 AM
i was recoding, today, a file of a project i am working on. that file had some code like example number 0. so i decided to recode it like example number 1. note that if the () are omitted, it is a syntax error where the interpreter is treating it as an assignment of three values (with the middle value being a conditional choice) to two variables, which does not make any sense.
so which of the two examples do you consider to be more readable?
example #0
so which of the two examples do you consider to be more readable?
example #0
if remote_hash > local_hash: use_key = remote_key use_name = remote_name else: use_key = local_key use_name = local_name print( 'using', use_name )example #1
use_key, use_name = (remote_key, remote_name) if remote_hash > local_hash else (local_key, local_name) print( 'using', use_name )
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.