函数的命名空间 著名的python之禅 Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't…
假如有一个函数,实现返回两个数中的较大值: def my_max(x,y): m = x if x>y else y return mbigger = my_max(10,20)print(bigger) 之前我们要把结果return回来,可是我们为什么要把结果返回?如果我们不返回m,直接在程序中打印,行不行? 来看结果: >>> def my_max(x,y): ... m = x if x>y else y ... >>> my_max(10,20) &…