I want to define a resize(h, w)
method, and I want to be able to call it in one of two ways:
resize(x,y)
resize(x)
Where, in the second call, I want y
to be equal to x
. Can I do this in the method definition or should I do something like resize(x,y=None)
and check inside:
if y is None:
y = x
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…