Is 'everything' a refrence or isn't it?

David Murmann david.murmann at rwth-aachen.de
Thu Jan 5 08:28:51 EST 2006


Dan Sommers schrieb:
> int **_idx;
> for( _idx = lst; _idx < lst + NLST; ++_idx ) {
>     int *i;
>     i = *_idx;
> 
>     /* compare "the item to which i is bound" to "a constant" */
>     if( *i == *(&_i2) )
>         /* rebind i to _i4 */
>         i = &_i4;
> }
> 
> for( _idx = lst; _idx < lst + NLST; ++_idx ) {
>     int *i = *_idx;
>     printf( "%d\n", *i );
> }

i don't see what is so fundamentally different in this version compared
to the one from Stuart Gathman (except it works, but i think it was a typo).
do you want to stress that python uses an iterator (if so, i would have
renamed _idx to _iter, because it ain't not index anymore)? whats the point
of not starting the for loop at 0? and is there a difference between
(*i == _idx) and (*i == *(&_idx))?

--
David.



More information about the Python-list mailing list