byte compiled files
Mark Robinson
m.1.robinson at herts.ac.uk
Fri Jul 27 04:35:55 EDT 2001
Thanks for the help guys, sorry I didn't include the code (what can I
say, duh). Anyway I did manage to fix the problem but I am still kinda
interested as to why I was getting that previous behaviour. I am running
python 2.1 under red hat 7, and python 2.1.1 under windows NT and had
the same problem under both. Here is the code:
def checkValidData(bsite):
repeats = ['AAAA', 'CCCC', 'GGGG', 'TTTT']
for x in bsite: #check new bsite contains valid charactors
if(x is not 'A' and x is not 'G' and
x is not 'C' and x is not 'T' ):
return 0
for x in repeats:
if (string.find(bsite, x) != -1):
return 0
return 1
Changing where I test if x is A, C, G or T by using the != test rather
than 'is not' solved the problem, and I guess I may have been using it
inappropriately, but I still don't see why it would have working
correctly first run and then incorrectly when working from the .pyc file.
Blobby
Mark Robinson wrote:
> can anyone shed some light on the mysterious behaviour of my byte
> compiled files. I am currently working on a python script which analyses
> patterns in a DNA sequence. I have a function which checks a pattern (a
> substring of approx 6 chars) to ensure only valid charactors are
> present. When I first run this program it runs fine, but if I
> immediately rerun the program (i.e using the pre-byte compiled file) it
> finds all patterns non-valid. If I delete the .pyc file between runs
> this problem does not occur. Can anyone explain what is happening here
> to me and how to prevent it?
>
> blobby
More information about the Python-list
mailing list