In article <mailman.12592.1407087500.18130.python-l...@python.org>, Mark Lawrence <breamore...@yahoo.co.uk> wrote:
> On 02/08/2014 20:58, Ben Finney wrote: > > Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> writes: > > > >> If you need instances which carry state, then object is the wrong > >> class. > > > > Right. The âtypesâ module provides a SimpleNamespace class for the > > common âbag of attributesâ use case:: > > > > >>> import types > > >>> foo = types.SimpleNamespace() > > >>> foo.x = 3 > > >>> foo > > namespace(x=3) > > > > <URL:https://docs.python.org/3/library/types.html#types.SimpleNamespace> > > > > A slight aside but from the link "SimpleNamespace may be useful as a > replacement for class NS: pass." I'm not quite sure how that class > definition is meant to read, other than guessing that NS stands for > NameSpace, any ideas? Trivia: argparse.ArgumentParser().parse_args() returns a Namespace.
-- https://mail.python.org/mailman/listinfo/python-list