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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4