[lug] Python Compiler Question
Wayde Allen
wallen at boulder.nist.gov
Tue Apr 18 14:33:47 MDT 2000
I recently wrote a short Python program that seems to run OK, but what is
interesting is that I don't seem to be getting the byte compiled version
of the program after running it once. In other words, I've got this
program opencalc.py and after running it I don't get an opencalc.pyc
version. I was thinking that this should always happen. What gives?
The code is quite short and simple:
#!/usr/bin/env python
# George Free's Open Circuit model
from math import sqrt, pow, atan2
startfreq = 0.001
endfreq = 1.001
freq = startfreq
Copen = 2e-13
PI = 3.1415926
print "#Open Circuit model used by George Free"
print "#"
print "# Freq, Magnitude, Phase"
while freq <= endfreq:
Yopen=complex(0,2 * PI * freq * 1e9 * Copen)
Opcalc = (1.0 - 50 * Yopen) / (1.0 + 50 * Yopen)
Magnitude = abs(Opcalc)
Phase = atan2(Opcalc.imag, Opcalc.real) * (360 / (2*PI))
print freq, Magnitude, Phase
freq = freq + 0.001
- Wayde
(wallen at boulder.nist.gov)
More information about the LUG
mailing list