Re: reduce()--what is it good for? (was: Re: reduce() anomaly?)
Georgy Pruss:[color=blue]
> I NEVER wondered which of constructions should I
> use in any particular case. I just solved the problem and wrote its[/color]
solution[color=blue]
> in that language and the language HELPED me to express myself clearly.[/color]
While I, when writing Perl code, also NEVER had a problem. I
ignored just about all of its variations
if ($cond) {$a++}
$a++ if $cond;
$a++ unless !($cond);
unless (!($cond)) {$a++};
I almost only used the first of these, and when other variations
in structure came up I again had a strong preference for the one
closest to C in feel. I did this not because it was the most expressive
but because I wanted to write code that others could follow,
and indeed one of the praises I got was "wow! It's Perl code I
can actually understand!"
[color=blue]
> Half of all the conditions in real Python programs are 1 or True. :-)[/color]
Cute as a joke, but in real-life it omits while loops, wherein
the conditionals usually end up being true. ;)
x = 1
while x < 1000:
print x
x = x + random.random(1 0)
Andrew
dalke@dalkescie ntific.com
Georgy Pruss:[color=blue]
> I NEVER wondered which of constructions should I
> use in any particular case. I just solved the problem and wrote its[/color]
solution[color=blue]
> in that language and the language HELPED me to express myself clearly.[/color]
While I, when writing Perl code, also NEVER had a problem. I
ignored just about all of its variations
if ($cond) {$a++}
$a++ if $cond;
$a++ unless !($cond);
unless (!($cond)) {$a++};
I almost only used the first of these, and when other variations
in structure came up I again had a strong preference for the one
closest to C in feel. I did this not because it was the most expressive
but because I wanted to write code that others could follow,
and indeed one of the praises I got was "wow! It's Perl code I
can actually understand!"
[color=blue]
> Half of all the conditions in real Python programs are 1 or True. :-)[/color]
Cute as a joke, but in real-life it omits while loops, wherein
the conditionals usually end up being true. ;)
x = 1
while x < 1000:
print x
x = x + random.random(1 0)
Andrew
dalke@dalkescie ntific.com
Comment