In the following code, why does setting the email_attachments list to 'attach1' in class test1 also set the email_attachments list in class test2 to 'attach1'?
Class:
class classtest:
smtp_server = ""
smtp_port = 0
email_attachments = []
def class_print(self):
print self.smtp_server
print self.smtp_port
print self.email_attachments
Script:
import ClassTest
def main():
test1 = ClassTest.classtest()
test1.smtp_server = "server1"
test1.smtp_port = "1"
test1.email_attachments.append("attach1")
test1.class_print()
print
test2 = ClassTest.classtest()
test2.smtp_server = "server2"
test2.class_print()
main()
results:
server1
1
['attach1']
server2
0
['attach1']