Raising the undead python

OUCH!


#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2005 John Diaz # This file is part of pyRadar. # pyRadar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # any later version. # pyRadar is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with pyRadar; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import sys import ftplib import gobject import shutil import os import os.path import platform import time #check for compatable python version pythonver = sys.version_info print pythonver #sys.exit(0) pythonver=(2,2,0,'final',0) if pythonver[0] < 2 and pythonver[1] < 4: print "This version of pyRadar requires" print "Python version 2.4.x or better" print "to run." sys.exit(1) pythonver=(1,7,0,'final',0) if pythonver[0] < 2 and pythonver[1] < 4: print "This version of pyRadar requires" print "Python version 2.4.x or better" print "to run." sys.exit(1) pythonver=(2,7,0,'final',0) if pythonver[0] != 2 or pythonver[1] != 6 : print "This version of pyRadar requires" print "Python version 2.6.x or better" print "to run." sys.exit(1) sys.exit(0)

What is wrong with this picture? It is python code, but the logic is all wrong. Firstly you do not need comments like "check version" and you can program all you like, but if you don't understand logic, hang up your shootin' irons!

An important thing is testing. That is one of the first things that I do. It isn't enough to imagine yourself as the perfect programmer, you must prove it to yourself. These tests do not pass and pyRadar1 and pyRadar2 show the same lack of logical skill as well as the assumption of correctness without test. I guess that there is about 4 lines of code that I find interesting and that is the ftp interface and I am not sure that is correct yet as I haven't gotten that far. I am going to remove the copyright and replace it with a new assignation as virtually all the code is not usable. The only part that is of interest is the FTP and since I have to revise and test that as well, I could just as easily start from scratch with the idea of showing a radar loop and call it something else.

I see that application of some beautiful soup and appropriate scraping at NOAA will yield something a bit more interesting and show some information that others might not think possible to conjugate from such a public data base.

On top of everything else the comments are mis-spelled. Hey, spell check is free! There is no wonder that this did not flow upstream to the debian python repository.

0 comments:

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen