Henry Precheur a écrit :
On Tue, Nov 24, 2009 at 11:16:05PM +0100, Sylvain Hellegouarch wrote:
Though it shouldn't be considered as a problem, the fact that probably
no existing framework actually use the raw dictionary (there is, in
almost all cases, a wrapping into a friendlier object), one might wonder
why keeping such a low level interface rather than directly provide a
higher level interface is a good idea. After all creating those
dictionaries for no good reason aside from sending them to the next
layer which will map them into a WebOb, a yaro, a cherrypy request, or
zope request, etc. seems slightly pointless
1. Would you say that POSIX is useless because there are lots of
libraries and applications build on top of it? Why not implement
those libraries and applications directly without using POSIX?
If I'm not mistaken that's what people do when they want performances
rather than portability. But point taken.
2. Guess what: WebOb, Werkzeug, Yaro, Django, CherryPy, and the others
have a different interfaces for their Request/Response objects.
Because for Request/Response there's hardly one-size fits all.
There's certainly some common ground, but every framework has
different needs.
Well thank you for the reminder but I kind of knew that ;)
It doesn't mean it's neither elegant nor efficient to create such a low
level object.
(I'm not versed into Python internals, but doesn't it have also a cost
of creating rather useless objects repeatedly like that?)
The dictionary is passed as a reference like every Python objects. So it
doesn't cost anything to use it instead of an object.
I talked about object creation not object passing.
- Sylvain
_______________________________________________
Web-SIG mailing list
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe:
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com