[Python-3000] Iterators for dict keys, values, and items == annoying :)
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat Apr 1 03:15:43 CEST 2006
Benji York wrote:
> If I, as the user of the interface, have something I want to
> pass in that doesn't match I it to the appropriate interface the burden
> is on me to create something that matches expectations. People do that
> all the time today without an interface/adaption framework, they just
> write code that takes one thing and builds another.
Yes, and that seems like a fine way of doing it. You
know what you've got and where you want to get to, so
there's no need to look anything up in a registry.
> Instead of building an API for looking up security descriptions from a
> user name that I have to pull out of the user object, I could instead
> register and adapter from IUser to ISecurityInfo,
I don't see how this is better than just calling
a get_security_info_from_user() function, the
implementation of which can be changed if necessary
without affecting any code that calls it.
> Looping over the form fields and adapting each to IWidget and getting
> back a TextField for a string, CheckBox for a boolean, etc.
Here I don't see how it's better than passing in
a dict mapping field classes to widget classes.
Worse, in fact, since it would seem to restrict
you to a single global mapping for all forms.
> once you have the simple tools of adaptation in mind
> ... you start to recognize places where they help
> you solve problems in better ways.
Or they lead you into an everything-is-a-nail
mode of thinking, which is what the above seem
to be to me, to some extent.
--
Greg
More information about the Python-3000
mailing list