In [1]:
class NameSpace():
    pass

In [2]:
foo = NameSpace()
foo


Out[2]:
<__main__.NameSpace at 0x7f1f881b0cf8>

In [3]:
def show_names(thing):
    return [name for name in dir(thing) if not name.startswith('__')]

In [4]:
show_names(foo)


Out[4]:
[]

In [5]:
foo.hello = 'world'

In [6]:
foo.bar = 3.1415926

In [7]:
show_names(foo)


Out[7]:
['bar', 'hello']

In [8]:
getattr(foo, 'hello')


Out[8]:
'world'

In [9]:
getattr(foo, 'bar')


Out[9]:
3.1415926

In [10]:
getattr(foo, 'world')


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-10-a09ebb842f14> in <module>()
----> 1 getattr(foo, 'world')

AttributeError: 'NameSpace' object has no attribute 'world'