Steven Bethard wrote: > Fernando Perez wrote: >> Steven Bethard wrote: >> > I'm probably not willing to budge much on adding dict-style methods -- >> > if you want a dict, use a dict. But if people think they're >> > necessary, there are a few methods from Struct that I wouldn't be too >> > upset if I had to add, e.g. clear, copy, etc. But I'm going to need >> > more feedback before I make any changes like this. >> >> You already have update(), which by the way precludes a bunch storing an >> 'update' attribute. > > Well, actually, you can have an update attribute, but then you have to > call update from the class instead of the instance:
[...] Of course, you are right. However, I think it would perhaps be best to advertise any methods of Bunch as strictly classmethods from day 1. Otherwise, you can have: b = Bunch() b.update(otherdict) -> otherdict happens to have an 'update' key ... more code b.update(someotherdict) -> boom! update is not callable If all Bunch methods are officially presented always as classmethods, users can simply expect that all attributes of a bunch are meant to store data, without any instance methods at all. Regards, f _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com