To write quick C things that Python won't do up to speed. So it's got a redundancy.
import ext extA= ext.Ext() extA[ 'enumfactors' ]= r""" int enumfactors( int a, const char* sep ) { int ret= 0, i; for( i= 1; i<= a; i++ ) { if( a% i== 0 ) { ret+= 1; if( i> 1 ) { printf( "%s", sep ); } printf( "%i", i ); } } printf( "\n" ); return ret; } """, ("i","i","s") factorsn= extA.enumfactors( 209677683, ', ' ) print( "%i factors total."% factorsn ) import sys sys.exit() 1, 3, 23, 69, 131, 393, 3013, 9039, 23197, 69591, 533531, 1600593, 3038807, 9116 421, 69892561, 209677683 16 factors total. -- http://mail.python.org/mailman/listinfo/python-list