Using set to avoid duplicate processing
<p>I have a part in a code like below where file name is supplied to the loop iteratively. I want that no two file names with same name should
get processed ( to avoid duplicate processing) so I used the approach of "set" as above.</p>

<p>However this does not seem to work as expected. I get an empty processed_set and logic is not executed as expected.</p>

<pre><code>else:
    create_folder(filename)
    processed_set=set()

    if xyz ==1:
        if filename not in processed_set:
          createdata(name)
          processed_set.add(filename)
        else:
          avoid_double_process(name)
</code></pre>
