On 6/3/2010 8:50 AM Tino Dai said...
Hi All,
Is there a way to express this:
isThumbnail = False
if size == "thumbnail":
isThumbnail = True
like this:
[ isThumbnail = True if size == "thumbnail" isThumbnail = False ]
and the scoping extending to one level above without resorting to the
global keyword?
If by 'extending one level above' you mean 'outside the current scope',
then yes if isThumbnail is mutable. ie, something like:
isThumbnail = [False]
# create scope
def inner(size):
isThumbnail[0] = bool(size == "thumbnail")
inner('not thumbnail')
print isThumbnail
inner('thumbnail')
print isThumbnail
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor