I am recently learning python and I am having an issue with object creation. I have created a class called pdf which helps to parse an inputted pdf(working). The issue I am having is that separate created objects are sharing memory space for a reason I am unsure of.
for root, dirnames, filenames in os.walk("../PDF_DB_100//"):
for filename in filenames:
if filename.endswith('.pdf'):
print filename
pdf("../PDF_DB_100/"+filename).get_info()
count+=1
if count == 10:
break
class pdf(object):
Uno = []
Dos = []
Tress = []
Quatro = []
def __init__(self,path):
operations, mostly appends onto the above variables
....
This code walks the dir for .pdf and creates an pdf object for 10 pdfs. But since the pdf object is not referenced shouldn't it go out of scope once the get_info() line is completed. Why do the separate pdf append data on to a single list?