"Tino Dai" <obe...@gmail.com> wrote
Is there a way to express this:
isThumbnail = False
if size == "thumbnail":
isThumbnail = True
like this:
[ isThumbnail = True if size == "thumbnail" isThumbnail =
False ]
Bob showed one way, you could also do:
isThumbnail = True if size == "thumbnail" else False
and the scoping extending to one level above without resorting
to the
global keyword?
Not sure what this has to do with scoping or the use of global?
global is only needed inside a function if you are modifying a
value defined outside the function.
If the assignment is inside a function and the definition of
isThumbnail is outside then you need to use global.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor