On 06/08/2012 01:49 PM, Akim Demaille wrote: > > Le 8 juin 2012 à 12:34, Stefano Lattarini a écrit : > >> On 06/08/2012 12:21 PM, Akim Demaille wrote: >>> >>>>> Every single modern language, especially functional ones, >>>>> have the "return" unnecessary. >>>>> >>>> Not the case for Python. >>> >>> Python is inconsistent on this regard. >>> >>>>>> a = lambda : 14 >>>>>> a() >>> 14 >>> >> Yeah, lambda functions in python are probably a chief example of >> "practicality beats purity" gone wrong … > > Really, I disagree. "return" is superfluous, its sole > role is to break control flow. > In my usages, it also has a role in making my intentions clearer. I agree that, technically, using "return VAL" instead of simply "VAL" at the end of a perl function is redundant, but that's a good redundancy IMO, because it makes the code more explicit *for the sake of human readers*. You may disagree and state that the extra noise thus introduced in not worth the extra clarity, but here we are in the realm of tastes and personal opinions.
> It's just a matter of habit, one gets used to it very quickly. > > In the example we are discussing about > > return; > > I would argue that what is explicit should be implicit > (return), and what is implicit should be explicit (the > () value). > > undef; > Good point. So I went for "return undef;" finally ;-) Regards, Stefano
