Re: setting variables from a tuple NEWB

2006-07-07 Thread Steven D'Aprano
On Thu, 06 Jul 2006 04:20:01 -0700, manstey wrote: > Hi, > > If I have a tuple like this: > > tupGlob = (('VOWELS','aeiou'),('CONS','bcdfgh')) > > is it possible to write code using tupGlob that is equivalent to: > VOWELS = 'aeiou' > CONS = ''bcdfgh' Why don't you just do that? VOWELS = 'aeio

Re: setting variables from a tuple NEWB

2006-07-06 Thread nate
manstey wrote: > Hi, > > If I have a tuple like this: > > tupGlob = (('VOWELS','aeiou'),('CONS','bcdfgh')) > > is it possible to write code using tupGlob that is equivalent to: > VOWELS = 'aeiou' > CONS = ''bcdfgh' could you use a dictionary instead? i.e. >>> tupGlob = {'VOWELS':'aeiou', 'CONS':'

Re: setting variables from a tuple NEWB

2006-07-06 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Paul McGuire wrote: tupGlob = (('VOWELS','aeiou'),('CONS','bcdfgh')) for nam,val in tupGlob: locals()[nam]=val > ... VOWELS > 'aeiou' CONS > 'bcdfgh' Little warning: It works only on module level as assigning to `locals()` return value in function

Re: setting variables from a tuple NEWB

2006-07-06 Thread Paul McGuire
"manstey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > If I have a tuple like this: > > tupGlob = (('VOWELS','aeiou'),('CONS','bcdfgh')) > > is it possible to write code using tupGlob that is equivalent to: > VOWELS = 'aeiou' > CONS = ''bcdfgh' > > Thanks, > Matthew > Try

setting variables from a tuple NEWB

2006-07-06 Thread manstey
Hi, If I have a tuple like this: tupGlob = (('VOWELS','aeiou'),('CONS','bcdfgh')) is it possible to write code using tupGlob that is equivalent to: VOWELS = 'aeiou' CONS = ''bcdfgh' Thanks, Matthew -- http://mail.python.org/mailman/listinfo/python-list