<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="IncrediMail 1.0" name=GENERATOR></HEAD>
<BODY style="BACKGROUND-POSITION: 0px 0px; FONT-SIZE: 12pt; MARGIN: 5px 10px 10px; FONT-FAMILY: Arial" bgColor=#ffffff background="" scroll=yes ORGYPOS="0">
<TABLE id=INCREDIMAINTABLE cellSpacing=0 cellPadding=2 width="100%" border=0>
<TBODY>
<TR>
<TD id=INCREDITEXTREGION style="FONT-SIZE: 12pt; CURSOR: auto; FONT-FAMILY: Arial" width="100%">
<DIV> </DIV>
<DIV> </DIV>
<DIV id=receivestrings>
<DIV dir=ltr style="FONT-SIZE: 11pt"><I><B>From:</B></I> <A href="mailto:jason.massey@gmail.com">Jason Massey</A></DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt"><I><B>Date:</B></I> 02/20/06 12:20:03</DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt"><I><B>To:</B></I> <A href="mailto:kermit@polaris.net">Kermit Rose</A></DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt"><I><B>Cc:</B></I> <A href="mailto:tutor@python.org">tutor@python.org</A></DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt"><I><B>Subject:</B></I> Re: [Tutor] import of source code still not working</DIV></DIV>
<DIV> </DIV>
<DIV><BR>If you don't want to have to put the factor30 in front of all your function names you can do this:<BR><BR>from factor30 import *<BR><BR>Which will put all of your functions into the global namespace.<BR><BR>Then you can call factor() & factor0() as you would expect to.<BR><BR></DIV>
<DIV> </DIV>
<DIV>*******</DIV>
<DIV> </DIV>
<DIV>Thank you very much</DIV>
<DIV> </DIV>
<DIV>Next dilemma is:</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><SPAN id=-102 title=tutor@python.org>>>> v = [2, 35715, 17859, -318417088, 8932, 17860, 1000009, 5]<BR>>>> v = transfac(v)<BR>-1<BR>2 35715 17859 -318417088 8932 17860</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN title=tutor@python.org>Traceback (most recent call last):<BR> File "<pyshell#8>", line 1, in -toplevel-<BR> v = transfac(v)<BR> File "c:\math\factoring\factor30.py", line 46, in transfac<BR> a,b,c,d,m,n = a,b.c+a*t,d-b*t,m+t,n<BR>AttributeError: 'int' object has no attribute 'c'<BR>>>> v<BR>[2, 35715, 17859, -318417088, 8932, 17860, 1000009, 5]</SPAN></DIV>
<DIV><SPAN title=tutor@python.org></SPAN> </DIV>
<DIV><SPAN title=tutor@python.org></SPAN> </DIV>
<DIV><SPAN title=tutor@python.org>Listing of transfac function is</SPAN></DIV>
<DIV><SPAN title=tutor@python.org></SPAN> </DIV>
<DIV><SPAN title=tutor@python.org></SPAN> </DIV>
<DIV><SPAN title=tutor@python.org>def transfac(v):<BR># import random<BR># begin level 0<BR> a = v[0]<BR> b = v[1]<BR> c = v[2]<BR> d = v[3]<BR> m = v[4]<BR> n = v[5]<BR> z = v[6] # line 10<BR> k = v[7]<BR> k = k + 1<BR> a2 = a%2<BR> b2 = b%2<BR> c2 = c%2<BR> d2 = d%2<BR># ma = ((d - n * c)/(a*m + b))/4<BR># ma = random.randint(1,min(abs(ma),abs(m))+1)<BR># na = ((d - m * b)/(a * n +c) )/4<BR># na = random.randint(1,min(abs(na),abs(n))+1) # line 20<BR># if v[3]<0:<BR># na=-na<BR># ma=-ma<BR># ma = ma * random.randint(0,1)<BR># if ma=0:<BR># pass<BR># else<BR># na = na * random.randint(0,1)<BR> j = 8 * a2 + 4 * b2 + 2 * c2 + d2<BR> if j == 0: a,b,c,d,m,n = a/2,b/2,c/2,d/2,m,n # line 30<BR> if j == 1: a,b,c,d,m,n = -1,-1,-1,-1,-1,-1<BR> if j == 2: a,b,c,d,m,n = a,b/2,c,d/2,m,2*n<BR> if j == 3: a,b,c,d,m,n = a,(a+b)/2,c,(d-c)/2,2*n+1<BR> if j == 4: a,b,c,d,m,n = a,b,c/2,d/2,2*m,n<BR> if j == 5: a,b,c,d,m,n = a,b,(a+c)/2,(d-b)/2,2*m+1,n<BR> if j == 6:<BR> # begin if level 1<BR> if b>c:<BR> # begin if level 2<BR> t=(d-b*m)/(a+c*m) # line 40 <BR> t=t/4 <BR> print t<BR> if t==0: t=1<BR> print a,b,c,d,m,n<BR> a,b,c,d,m,n = a,b.c+a*t,d-b*t,m+t,n<BR> # end if level 2 # line 46<BR> else:<BR> # begin if level 2<BR> t=(d-c*n)/(b+a*m)<BR> t=t/4 # line 50<BR> if t==0: t=1<BR> a,b,c,d,m,n = a,b+a*t,c,d-c*t,m,n+t<BR> # end if level 2<BR> # end if level 1<BR># a,b,c,d,m,n = a,a*na+b,a*ma+c,d-a*ma*na - b*ma - c * na,m+ma,n+na<BR> if j == 7:<BR> # begin if level 1<BR> if b>c:<BR> # begin if level 2<BR> t=(d - b * m)/(c + a*m)<BR> t=t/4<BR> if t == 0: t=1<BR> a,b,c,d,m,n = a,b,c+a*t,d-b*t,m+t,n<BR> else:<BR> # continue if level 2<BR> t=(d - c * n)/(b+a*n)<BR> t=t/4<BR> if t == 0: t=1<BR> a,b,c,d,m,n = a,b+a*t,c,d-c*t,m,n+t<BR> # end if level 2<BR> # end if level 1<BR> if j == 8: a,b,c,d,m,n = -1,-1,-1,-1,-1,-1<BR> if j == 9: a,b,c,d,m,n = 2*a,a+b,a+c,(d-a-b-c)/2,2*m+1,2*n+1<BR> if j == 10:<BR> # begin if level 1<BR> if b>c:<BR> # begin if level 2<BR> t=(d - b * m)/(c + a * m)<BR> t=t/4<BR> if t==0: t=1<BR> a,b,c,d,m,n = a,b,c+a*t,d-b*t,m+t,n<BR> # end if level 2<BR> else:<BR> # continue if level 1<BR> t=(d - c * n)/(c + a * n)<BR> t=t/4<BR> if t==0: t=1<BR> a,b,c,d,m,n = a,b+a*t,c,d-c*t,m,n+t<BR> # end if level 2<BR> # end if level 1<BR> if j == 11: a,b,c,d,m,n = 2*a,a+b,c,(d-c)/2<BR> if j == 12:<BR> # begin if level 1<BR> if b>c:<BR> # begin if level 2<BR> t=(d - b * m)/(c + a * m)<BR> t=t/4<BR> if t==0: t=1<BR> a,b,c,d,m,n = a,b,c+a*t,d-b*t,m+t,n<BR> else:<BR> # continue if level 2<BR> t=(d - c * n)/(b + a * n)<BR> t=t/4<BR> if t==0: t=1<BR> a,b,c,d,m,n = a,b+a*t,c,d-c*t,m,n+t <BR> # end if level 2<BR> # end if level 1 <BR> if j == 13: a,b,c,d,m,n = 2*a,b,a+c,(d-b)/2,m,2*n+1<BR> if j == 14: a,b,c,d,m,n = 2*a,b,c,d/2,2 *m,2*n<BR> if j == 15:<BR> # begin if level 1<BR> if b>c:<BR> # begin if level 2<BR> t=(d - b * m)/(c + a * m)<BR> t=t/4<BR> if t==0: t=1<BR> a,b,c,d,m,n = a,b,c+a*t,d-b*t,m+t,n<BR> else:<BR> # continue if level 2<BR> t=(d - c * n)/(b + a * n)<BR> t=t/4<BR> if t==0: t=1<BR> a,b,c,d,m,n = a,b+a*t,c,d-c*t,m,n+t<BR> # end if level 2<BR> # end if level 1<BR> z = a * d + b * c<BR> v = [a,b,c,d,m,n,z,k]<BR> return v<BR># end routine level 0<BR></SPAN></DIV>
<DIV><SPAN title=tutor@python.org></SPAN> </DIV>
<DIV><SPAN title=tutor@python.org> </DIV></SPAN>
<DIV> </DIV></TD></TR>
<TR>
<TD id=INCREDIFOOTER width="100%">
<TABLE cellSpacing=0 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD width="100%"></TD>
<TD id=INCREDISOUND vAlign=bottom align=middle></TD>
<TD id=INCREDIANIM vAlign=bottom align=middle></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>