Newbie asks: How to translate this line of C to Py

Erik Max Francis max at alcyone.com
Tue Jul 10 01:27:05 EDT 2001


"Steve S.L. Wong" wrote:

> while (command = strtok(line_ptr,";"),line_ptr=0,command) {
> }

Whoever wrote that should be taken out and fed worms.  This is
deliberately and unnecessarily obfuscated.

All this does is tokenize the contents of line_ptr.  In Python the
equivalent would simply be:

	for command in line_ptr.split(';'):
	    ...

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ All the people in his neighborhood turn around and get mad and sing
\__/ Public Enemy
    Kepler's laws / http://www.alcyone.com/max/physics/kepler/
 A proof of Kepler's laws.



More information about the Python-list mailing list