[Python-Dev] PEP 246, redux

Alex Martelli aleax at aleax.it
Thu Jan 13 18:43:16 CET 2005


On 2005 Jan 13, at 16:13, Carlos Ribeiro wrote:
    ...
> +1, specially for the last sentence. An adapter with local state is
> not an adapter anymore! It's funny how difficult it's to get this...
> but it's obvious once stated.

...?  A StringIO instance adapting a string to be used as a 
readablefile is not an adapter?!  It's definitely a pristine example of 
the Adapter Design Pattern (per Gof4), anyway... and partly because of 
that I think it SHOULD be just fine as an ``adapter''... honestly I 
fail to see what's wrong with the poor StringIO instance keeping the 
"we have read as far as HERE" index as its "local state" (imagine a 
readonlyStringIO if you want, just to make for simpler concerns).

Or, consider a View in a Model-View-Controller arrangement; can't we 
get THAT as an adapter either, because (while getting most data from 
the Model) it must still record some few presentation-only details 
locally, such as, say, the font to use?

I'm not sure I'm all that enthusiastic about this crucial aspect of 
PJE's new "more pythonic than Python" [r]evolution, if it's being 
presented correctly here.


Alex



More information about the Python-Dev mailing list