[Python-talk] Initializing a class...
bruce.labitt at autoliv.com
bruce.labitt at autoliv.com
Wed Sep 2 15:38:46 EDT 2009
The client server app I'm creating is so far going ok. The usual debug
and whatnot is in process.
One thing that I have stumbled upon is that an instance of a class I
created is not being initialized as I expected. I thought (and apparently
I was wrong -- what a surprise...) that merely creating an instance of it
was enough.
So how does one do this?
class myVars:
def __init__(self):
self.bufsize = 32
self.bufdat = zeros(32)
self.fftsize = 1
self.oldfftsize = 0
self.fftinput = zeros(self.fftsize)
+1j*zeros(self.fftsize)
self.fftoutput = zeros(self.fftsize) +
1j*zeros(self.fftsize)
self.dt = 1.0e-13
def othermethods:
I thought just doing the following was sufficient:
c = myVars()
print 'FFT initial data is', c.fftinput
But I get AttributeError: myVars instance has no attribute 'fftinput'
Where am I going astray? How do I init c?
Bruce Labitt
Autoliv Electronics
1011B Pawtucket Blvd, PO Box 1858
Lowell, MA 01853
Email: bruce.labitt at autoliv.com.
Tel: (978) 674-6526
Fax: (978) 674-6581
******************************
Neither the footer nor anything else in this E-mail is intended to or constitutes an <br>electronic signature and/or legally binding agreement in the absence of an <br>express statement or Autoliv policy and/or procedure to the contrary.<br>This E-mail and any attachments hereto are Autoliv property and may contain legally <br>privileged, confidential and/or proprietary information.<br>The recipient of this E-mail is prohibited from distributing, copying, forwarding or in any way <br>disseminating any material contained within this E-mail without prior written <br>permission from the author. If you receive this E-mail in error, please <br>immediately notify the author and delete this E-mail. Autoliv disclaims all <br>responsibility and liability for the consequences of any person who fails to <br>abide by the terms herein. <br>
******************************
More information about the Python-talk
mailing list