python has "foo = .. if .. else ..", 20 lines shorter