Hi, my friends,

I am new to python. I have a question to ask you a empty class with a set of data memebers. The data members could be array. what is wrong with the following code?
Thanks in avvance.

# define an empty calss
class temp:
pass

# copy1 is a copy of class with only data members (could be 1-dimension array
copy1 = temp
tem2 = ones(100)
copy1.x(:) = tem2(:)

when I run this code to debug, it says invalid syntax in the last line of code. I could not figure out why. Help please. Is there any place to find good source about CLASS usage in python.

John

You probably needed to say copy1 = temp() , otherwise copy1 is a copy of the class temp instead of an instance of the class temp.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.