From: Ian B. <ia...@co...> - 2001-04-04 22:13:09
|
Tavis Rudd <ta...@ca...> wrote: > I'd argue the same thing for req.fields['key'], res.cookies['key'], > res.headers['key'], etc. Later, if you wanted to reimplement > req.fields as a method that returns the field object you could use > Paul Dubuois' ActiveAttr mixin to preserve the user interface. I don't think ActiveAttr should ever need to be used. For things like fields, cookies, and headers (which are all quite unambiguous), the object that implements these interfaces is really just a shell. As such, it can easily be just as dynamic as the current system. That is, res.cookies is an object which is firmly attached to res. The initial implementation should leave that tie intact, and then despite any changes elsewhere in HTTPResponse it shouldn't be effected. The class I posted a while ago (attached again, for argument's sake) does this and is exactly as dynamic as the current system (and backward compatible). It also implements active attributes, but that can be ignored for this discussion. Anyway, while I love Smalltalk and understand why it does things its way, Python isn't Smalltalk -- in particular, Smalltalk syntax makes these getter and setter methods nice, but they aren't very nice in Python. -- Ian |