[Tutor] Question about why a list variable is apparently global.

Alan Gauld alan.gauld at btinternet.com
Thu Nov 27 18:50:11 CET 2014


On 27/11/14 16:07, boB Stepp wrote:

> Alan's reference to indentation level had me trying to prove the
> opposite--unsuccessfully.

Yeah, I probably over-simplified there in response to your assumption 
that it was the order that mattered. It's really whether they are
inside a function or class - which means they will be indented.

But variables defined inside loops etc are also indented but still at 
global scope since the containing block is global.


-- 
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