Being new to Python I am getting a result I do not understand.
I have a code that reads in a set of lines from a file, slits up
the lines and puts information into a list of class objects.

    obslist = mpc.Read_Observations(options.in_fname) ;
   
    for testobs in obslist:
        print testobs.printmpc()

where the class is defined as

class MPC_Observation:
    def __init__(self,iname,iepoch,ira,idec,imag,iobscode):
        self.name = iname
        self.epoch = iepoch
        self.ra = ira
        self.dec = idec
        self.obscode = iobscode
        self.mag = imag
    def printmpc(self):
        if self.mag!="":
            print "%14s  %12.5f  %5.2f  %6.2f  %8.3f  %3i" \
                    % (self.name, self.epoch, self.ra,self.dec,self.mag,self.obscode)
        else:
            print "%14s  %12.5f  %5.2f  %6.2f            %3i" \
                    % (self.name, self.epoch, self.ra,self.dec,self.obscode)


But when I run the code I get a bunch of lines with None output

  Albiorix        2005.00000  133.03   17.77            695
None
  Albiorix        2005.00000  133.03   17.77            695
None
  Albiorix        2005.00000  133.03   17.77            695
None
  Albiorix        2005.00000  133.03   17.77            695
None
  Albiorix        2005.00000  133.01   17.78            695
None

I don't understand where these None's are coming from.
Anyone care to enlighten me?


Cheers

Tommy



[EMAIL PROTECTED]

http://homepage.mac.com/tgrav/


"Any intelligent fool can make things bigger, 
more complex, and more violent. It takes a 
touch of genius -- and a lot of courage -- 
to move in the opposite direction"
                         -- Albert Einstein


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to