I have created a class:
class document:
titre = ''
haveWords = set()
def __init__(self, string):
self.titre = string
#########
doc1 = document('doc1' )
doc2 = document('doc2' )
doc1.haveWords. add(1)
doc2.haveWords. add(2)
print doc1.haveWords
# i get set([1, 2])
doc1 and doc are sharing attribute haveWords!
Why ??? there's a way to assign every objetc "document" a different
"set"
class document:
titre = ''
haveWords = set()
def __init__(self, string):
self.titre = string
#########
doc1 = document('doc1' )
doc2 = document('doc2' )
doc1.haveWords. add(1)
doc2.haveWords. add(2)
print doc1.haveWords
# i get set([1, 2])
doc1 and doc are sharing attribute haveWords!
Why ??? there's a way to assign every objetc "document" a different
"set"
Comment