What to do after Python?

Erik Max Francis max at alcyone.com
Mon Feb 19 04:22:25 CET 2001


Johann Hibschman wrote:

> Really?  Any language that encourages
> 
> vector<double>::iterator end = vec->end();
> vector<double> out(vec->size);
                              ^
Oops.

> for(vector<double>::const_iterator i = vec->begin(),
>     vector<double>::iterator j = out->begin();
>     i != end;
>     ++i, ++j) {
>   *j = (*i)*(*i);
> }
> 
> as the right way to square a vector is, well, not quite the way I'd
> want to do that.

You mean generate another vector whose elements contain the squares of
the first vector.  The usual meaning of "squaring a vector" would
involve vector reduction.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Dead men have no victory.
\__/ Euripides
    REALpolitik / http://www.realpolitik.com/
 Get your own customized newsfeed online in realtime ... for free!



More information about the Python-list mailing list