Simulate a Java-like enum type. An instance is initialized with a list of tuples, the first value of each is
the enum member name, the following are the values that name stores. If instead a list of strings is given those
strings are used as the name and value, similarly if a list of singleton tuples is given the names are used as
values. An entry can be accessed as a member of the object using the given name if the name with spaces replaced
with _ is a valid Python identifier.
A second member with the same name prepended with _ returns the name itself. The [] operator can query
values by index or by name. Containment (in/not in) is defined as name membership in the enum.
The members of the enum are also iterable in the given order, each element being a tuple of the name+values.
The constructor accepts keyword arguments to define secondary properties of the enum: "doc" should contain a
documentation string describing the members of the enum, and "valtype" should be a tuple stating the type for each
value in the entries, which assumes all entries have values of the same type.
Eg. given e=enum( ('foo',1,2), ('bar',3,4), ('baz thunk', 5), ('plonk',) )
'foo' in e -> True
e.foo -> (1,2)
e._foo -> 'foo'
e[1] -> ('bar',3,4)
e['bar'] -> (3,4)
e.baz_thunk -> 5
e.plonk -> 'plonk'