for(each) element aliasing

Andreas Lobinger andreas.lobinger at netsurf.de
Mon Nov 22 11:34:00 EST 2004


Aloha,

Matija Papec wrote:
> my @arr = 1..3;
> for my $element (@arr) {
>   $element *= 2;
> }
> print "@arr\n";
> 2 4 6

 >>> arr = [1,2,3]
 >>> print [element*2 for element in arr]
[2, 4, 6]

Wishing a happy day
		LOBI



More information about the Python-list mailing list