On Thu, May 22, 2008 at 5:22 AM, Aahz aahz@pythoncraft.com wrote:
On Thu, May 22, 2008, Brandon Mintern wrote:
I would like to propose to change the built-in function "object" to have the following syntax:
object(**kwargs) Return a new featureless object. object is a base for all new style classes. It has the methods that are common to all instances of new style classes.
Enh. It's easy enough to write
class Obj: def __init__(self, **kwargs): self.__dict__.update(kwargs)
It's not clear to me that your functionality is desired frequently enough *in that specific form* to warrant changing object(). Note particularly the emphasis; over the years, I've seen various small variations in how people want kwargs processed and it's not at all clear to me that codifying one specific form into the language would be helpful.
This is the answer that came to my mind.
Also note that not all classes give their instances a __dict__, and object (being the simplest object possible) does not -- so object(foo=1) wold not have a place where to store the 'foo': 1 mapping.