[Tutor] a few question about my evolving program

Alan Gauld alan.gauld at btinternet.com
Thu Aug 13 00:24:10 CEST 2015


On 12/08/15 18:54, Clayton Kirkwood wrote:

>> If I understand your 'question', your code *should* reduce to this for the
>> given filename:
>>




>>
>> Now, what is your expected output?
>> And what are you getting?
>> I'm not sure I understand what Question 2 actually is...
>
> Given the data provided one could see that the current_filename, blah.jpg
> didn't exist in the important target_directory_file_list of a.jpg,  b.jpg,
> c.jpg
> Yet the next line of code is executed.

That's my point.
There is no next line of code.

See the simplified (and shortened) code I sent:

target_file_list = master_directory_file_list[target_directory]
...
for path in master_directory_file_list.keys():
     files = master_directory_file_list[path]
     for name in files:
         if name in target_file_list:


If name is not in the target list it just falls off the end
and goes back to get the next name.

So what do you think is being executed and why?


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list