sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #02996
[Question #159721]: Is it necessary to destroy finder after casting it to list?
New question #159721 on Sikuli:
https://answers.launchpad.net/sikuli/+question/159721
http://sikuli.org/docx/finder.html
Doc says Finder has to be destroyed when used with for: or while:
Is it necessary to destroy it when converting to list? E.g.
matches = list(finder)
Isn't it destroyed automatically after leaving local scope, where a region.getLastMatches() function was called?
With the information above the second example at http://sikuli.org/docx/finder.html (which could have a link for easy referencing by the way) can be simplified from :
...
f.find(img) # find all matches
mm = [] # an empty list
while f.hasNext(): # loop as long there is a first and more matches
mm.append(f.next()) # access next match and add to mm
print f.hasNext() # is False, because f is empty now
f.destroy() # release the memory used by finder
to:
...
mm = list(f.find(img))
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.