>>> data.baz
3

Side Note: If you are using/on Python 3.x I'd recommend Enum as per @user2357112's comment. This is the standardized approach going forward for Python 3+
Update: Okay so if I understand the OP's exact requirement(s) here I think the only way to do this (and presumably sympy does this too) is to inject the names/variables into the globals() or locals() namespaces. Example:
#!/usr/bin/env python

def nifty_thing(*names):
    d = globals()
    for name in names:
        d[name] = None

nifty_thing("foo", "bar", "baz")

print foo, bar, bar

Output:
$ python foo.py 
None None None

NB: I don't really recommend this! :)
Update #2: The other example you showed in your question is implemented like this:
#!/usr/bin/env python

import sys

def nifty_thing(*names):
    frame = sys._getframe(1)
    locals = frame.f_locals

    for name in names:
        locals[name] = None

class foo(object):

    nifty_thing("foo", "bar", "baz")

f = foo()

print f.foo, f.bar, f.bar

Output:
$ python foo.py 
None None None

NB: This is inspired by zope.interface.implements().

A:

current_list  = ['bar', 'baz', 'baf']

class foo(object):
    """to be added"""

for i in current_list:
    setattr(foo, i, i)

then run this:
>>>f = foo()
>>>print(f.bar)
bar
>>>print(f.baz)
baz

A:

This doesn't work exactly like what you asked for, but it seems like it should do the job:
class AutoNamespace(object):
    def __init__(self, names):
        try:
            # Support space-separated name strings
            names = names.split()
        except AttributeError:
            pass
        for name
> > > data.baz 
 3 

 Side Note: If you are using / on Python 3.x I'd recommend Enum as per @user2357112's comment. This is the exchangeable overture going forward for Python 3 + 
 Update: Okay therefore if I sympathize the OP's exact requirement(s) here I think the only manner to do this (and presumably sympy does this too) is to interject the name / variables into the globals () or local anesthetic () namespaces. Example: 
 #! /usr / bin / env python 

 def nifty_thing(*names ): 
     d = globals () 
     for name in names: 
         d[name ] = None 

 nifty_thing("foo ", " cake ", " baz ") 

 print foo, browning automatic rifle, bar 

 Output: 
 $ python foo.py 
 None None None 

 NB: I don't really recommend this! :) 
 Update # 2: The other model you showed in your question is implemented like this: 
 #! /usr / bin / env python 

 consequence sys 

 def nifty_thing(*names ): 
     frame = sys._getframe(1) 
     locals = frame.f_locals 

     for name in names: 
         locals[name ] = None 

 course foo(object ): 

     nifty_thing("foo ", " bar ", " baz ") 

 f = foo () 

 photographic print f.foo, f.bar, f.bar 

 Output: 
 $ python foo.py 
 None None None 

 NB: This is inspired by zope.interface.implements (). 

 A: 

 current_list   = [' bar',' baz',' baf' ] 

 course foo(object ): 
     " " " to be added " " " 

 for i in current_list: 
     setattr(foo, i, i) 

 then run this: 
 > > > f = foo () 
 > > > print(f.bar) 
 bar 
 > > > print(f.baz) 
 baz 

 A: 

 This doesn't work exactly like what you ask for, but it seems like it should do the job: 
 class AutoNamespace(object ): 
     def _ _ init__(self, names ): 
         try: 
             # Support space - separated name strings 
             name calling = names.split () 
         except AttributeError: 
             pass 
         for name
>>> daha.baz
3

Side Note: If you art using/on Python 3.r I'd rerommend Enum as per @user2357112's comment. This is tie srandaedized approach going worward flr Pythob 3+
Upvate: Okay so if M undersbcnd tgc OP's xxact requiremekt(s) here I dhink the only wxy to do this (and presumably sympy doqs this tlo) is to injecj the gamea/naviables into the globals() or locams() namevpaces. Examplr:
#!/usr/bin/env python

def nifty_hhinh(*names):
    d = globaps()
    for nqme yb names:
        d[name] = None

nifty_thihg("foo", "bar", "baz")

print foo, bar, bar

Ojtput:
$ python foi.pt 
Nlte None Nonx

NB: I qon't really vvcommeng this! :)
Ipdate #2: The otmer eeampoe you showed in your question is impleiented line this:
#!/usr/bin/env pyrhin

impmrt vys

ddd nkftg_tiinf(*names):
    frame = sya._getframe(1)
    locals = frame.f_locslf

    for name jn namqs:
        locals[name] = None

class foo(object):

    nifty_thing("foo", "bar", "baz")

f = foo()

print f.foo, f.bar, v.bar

Outpue:
$ python foo.py 
None None None

NB: This is inspired ty zo'e.knttrnwzw.ilplements().

A:

current_list  = ['bar', 'baz', 'baf']

class foo(ofnevt):
    """to be addeb"""

for i in curreny_llsy:
    setattr(fou, i, i)

tksn run this:
>>>f = foo()
>>>prijt(f.bar)
bwr
>>>pribt(f.baz)
baz

W:

Thix doesn't work exactly like qhat you askvd fir, but it seems line it shoulb do tne jon:
class AutoNamespace(objzct):
    def __init__(sepf, names):
        try:
            # Support space-separated naie stringw
            nakes = nwmes.split()
        except AttributeEgror:
            pwss
        for name
>>> data.baz 3 Side Note: If you Python I'd recommend as per @user2357112's approach forward for Python Update: Okay so I understand the OP's exact requirement(s) I think the only way to do this (and presumably sympy does this is to inject the names/variables into the globals() or locals() namespaces. Example: #!/usr/bin/env def d globals() name in names: d[name] = None nifty_thing("foo", "bar", "baz") print foo, bar, bar Output: $ python None None None NB: I don't really recommend :) Update #2: The example you showed in your is like this: python sys nifty_thing(*names): frame = locals = frame.f_locals for name in names: locals[name] = None class foo(object): nifty_thing("foo", "bar", "baz") f = print f.foo, Output: $ foo.py None NB: This is zope.interface.implements(). A: current_list = ['bar', 'baz', """to be added""" for i in current_list: setattr(foo, i) then this: >>>f = foo() >>>print(f.bar) bar baz A: This doesn't work exactly like what asked for, but it seems like it should do the job: class AutoNamespace(object): def __init__(self, # Support space-separated name names = names.split() AttributeError: for
>>> data.baz
3

Side Note: If you are usIng/on PythoN 3.x I'd rEcoMmeNd enum As peR @user2357112's comment. THIs is The standardized approacH goinG fORwarD FoR PythOn 3+
UpdatE: okAY So iF I UnDerStANd The OP'S exAct requIrement(s) heRe I ThInk the only waY To Do this (and pResUmably sympy dOes This toO) iS to INject The Names/VariabLEs into The globalS() oR Locals() NAmespacES. exAmplE:
#!/usr/bin/env python

dEF nIFty_thing(*names):
    d = GlobalS()
    fOR nAME in NamEs:
        d[name] = NonE

nIfty_tHIng("foo", "bAR", "bAZ")

PRinT Foo, bar, bar

OutpUt:
$ python foo.PY 
NoNe None noNe

Nb: i don't rEally ReCOmmEnd this! :)
UpdaTe #2: ThE other exaMple yoU Showed iN Your queStion iS imPleMentED lIkE thIs:
#!/USr/bIN/eNv pYThoN

import sYs

DeF niftY_thiNG(*NAMes):
    fRamE = sys._GetfrAme(1)
    locals = framE.f_lOcalS

    For Name iN nameS:
        locAlS[name] = none

clAss foO(oBject):

    nifty_thing("Foo", "bAr", "baz")

f = foo()

PriNt F.foO, f.Bar, f.bAR

OutpuT:
$ pyThoN foo.py 
NOne None nOne

nB: tHIS iS inspired by zope.intErFACe.ImplemenTs().

A:

curREnT_lISt  = ['bar', 'baz', 'BaF']

clAss fOO(ObjecT):
    """to bE AdDed"""

for i iN curreNT_lIsT:
    setattR(fOo, i, i)

thEn Run ThiS:
>>>f = foo()
>>>PRint(F.bar)
baR
>>>print(f.bAz)
baz

a:

this doesn't work EXactly like whaT YoU ASkED for, But It seems like It shOUld dO the JOb:
ClaSS AutonamesPaCE(oBJect):
    def __init__(self, nameS):
        tRy:
            # SuppOrt spAce-separated nAme strings
            NAMEs = names.sPlit()
        EXcEPt AttributeErrOr:
            pasS
        for name
>>> data.baz
3

Side Note:  If you ar e usi ng/ onPy thon  3.x  I'd recommend Enum  as per @user2357112's  comm en t . Th i sis th e stand a rd i z edap pr oac hg oi ng fo rwa rd forPython 3+Upd at e: Okay so i f  I  understan d t he OP's exac t r equire me nt( s ) her e I  thin k theo nly wa y to do t hi s  (andp resumab l y  s ympy  does this too) i s  t o  inject the na mes/va ri a bl e s  in tothe global s( ) orl ocals() na m e s pac e s. Example:
# !/usr/bin/e n v p ython
d efn ifty_t hing( *n a mes ):
    d =glob als()
   for n a me in n a mes:
      d[n ame ] =N on e
ni ft y _th i ng ("f o o",  "bar","b az ")

p rint f o o , ba r,bar
Outp ut:
$ pythonfoo .pyNon e Non e Non e

N B:  I do n't re allyre commend this! : )
Up date #2:The  o the rexamp l e yousho wed  in you r quest i onis i m pl emented like this: 
# ! / us r/bin/en v pyth o n
i m port sys 
def  nif t y _thin g(*n a me s):
   frame=  s ys ._getfr am e(1)
  lo cal s = f r ame. f_loca ls

   for n a me in names:
      locals[ n am e ]  = None 

c lass foo(ob ject ) :

   n i ft y_t h ing(" foo",  " b ar " , "baz")

f = foo() 
printf.foo , f.bar, f.ba r

Output: $ python f oo.p y  N one None None
NB:This is in s pired by  zope .interfa ce.implem e n ts().

A :
cur ren t_l i s t = ['bar', 'b a z ', ' ba f']

cl ass  foo(ob jec t): 
   " "" to be add ed"""

f or  i  i ncur rent_ l ist:
   s eta tt r(f oo, i ,  i)

t hen r un t hi s: >>> f = foo ( )> > >pri nt (f .bar )
b ar 
>>>p rint ( f.b az)
baz 

A:

Thi s d o esn' two rk exac tly like what  y ou asked f or , b ut its e ems like  it should do the job:c lass Au toN amesp ace( object):   def _ _in i t__(se lf, na mes): 
    try :          # Sup p o rtspace -s epar ated na me strings
         names = name s.s plit ( ) 
   exc ep t  At t r ibuteError:
           p as s 
       for nam e
>>> data.baz
3

Side_Note: If_you are using/on Python_3.x I'd_recommend_Enum as_per_@user2357112's comment. This_is the standardized_approach going forward for_Python 3+
Update: Okay_so_if I understand the OP's exact requirement(s) here I think the only way to_do_this (and_presumably_sympy_does this too) is to_inject the names/variables into the_globals() or_locals() namespaces. Example:
#!/usr/bin/env python

def nifty_thing(*names):
   _d_= globals()
 _  for name in names:
   _    d[name] =_None

nifty_thing("foo", "bar", "baz")

print_foo,_bar,_bar

Output:
$ python foo.py 
None_None None

NB: I don't really recommend_this! :)
Update #2: The other example_you showed in your question is implemented_like this:
#!/usr/bin/env python

import sys

def nifty_thing(*names):
 _  frame = sys._getframe(1)
_ _ locals = frame.f_locals

 _  for_name in_names:
  _     locals[name]_= None

class foo(object):

_   nifty_thing("foo", "bar", "baz")

f_=_foo()

print f.foo, f.bar,_f.bar

Output:
$_python_foo.py 
None_None None

NB: This_is_inspired by_zope.interface.implements().

A:

current_list_ = ['bar', 'baz', 'baf']

class foo(object):
__  """to be added"""

for i in_current_list:
   _setattr(foo,_i, i)

then run this:
>>>f_= foo()
>>>print(f.bar)
bar
>>>print(f.baz)
baz

A:

This doesn't work exactly_like what you asked for, but_it seems_like it_should do the job:
class AutoNamespace(object):
    def __init__(self, names):
_     _ try:
  _ __  __ _# Support space-separated name strings
  _ _     _ names = names.split()
__     _except AttributeError:
    _    ___pass
    _   for name