Atomic Power

Lets represent Atom objects using syntax associated
with the namedtuple type (in collections)

class Atom:
  def __init__(self, protons, mass, symbol, long_name):
    self.protons = protons
    self.mass = mass
    self.symbol = symbol
    self.long_name = long_name
  def __getitem__(self, idx):  # access by integer
    if idx == 0:
      return self.protons
    elif idx == 1:
      return self.mass
    elif idx == 2:
      return self.symbol
    elif idx == 3:
      return self.long_name
      raise IndexError("tuple index out of range")
  def __repr__(self):
    fmt = "Atom(protons={protons}, mass={mass}, symbol='{symbol}', long_name='{long_name}')"
    return fmt.format(**self.__dict__) # named args
# testing

# a dict with all the data for Hydrogen
args = {"protons":1, "mass":1.008, "symbol":"H", "long_name":"Hydrogen"}
the_atom = Atom(**args) # explode into named args
the_atom = Atom(*args.values()) # explode into positional args