New submission from Mark Summerfield:

Right now object() does not accept any args and returns the lightest possible 
featureless object (i.e., without even a __dict__).

This is great.

However, it is really useful sometimes to be able to create an object to hold 
some editable state (so not a namedtuple). Right now this can be done with 
types.SimpleNamespace().

I think it would be a useful enhancement to have object() work as it does now, 
but to allow it to accept kwargs in which case it would provide identical 
functionality to types.SimpleNamespace().

This arises from an email I wrote to the python mailinglist:
https://groups.google.com/d/msg/comp.lang.python/9pY7hLp8lDg/voYF8nMO6x8J

But I also think it would be useful more generally.

----------
components: Interpreter Core
messages: 224539
nosy: mark
priority: normal
severity: normal
status: open
title: Make object() behave exactly like types.SimpleNamespace() if given kwargs
type: enhancement
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22123>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to