[Python-Dev] PEP 246: lossless and stateless

Steven Bethard steven.bethard at gmail.com
Sat Jan 15 01:37:13 CET 2005


On Fri, 14 Jan 2005 19:02:52 -0500, Glyph Lefkowitz <glyph at divmod.com> wrote:
> On Fri, 2005-01-14 at 10:07 -0500, Phillip J. Eby wrote:
>
> > Maybe I'm missing something, but for those interfaces, isn't it okay to
> > keep the state in the *adapted* object here?  In other words, if PointPen
> > just added some private attributes to store the extra data?
>
> I have been following this discussion with quite a lot of interest, and
> I have to confess that a lot of what's being discussed is confusing me.
> I use stateful adapters quite a bit - Twisted has long had a concept of
> "sticky" adapters (they are called "persistent" in Twisted, but I think
> I prefer "sticky").  Sometimes my persistent adapters are sticky,
> sometimes not.  Just's example of iter() as an adaptation is a good
> example of a non-sticky stateful adaptation, but this example I found
> interesting, because it seems that the value-judgement of stateless
> adapters as "good" is distorting design practices to make other
> mistakes, just to remove state from adapters.  I can't understand why
> PJE thinks - and why there seems to be a general consensus emerging -
> that stateless adapters are intrinsically better.

My feeling here was not that people thought that stateless adapters
were in general intrinsically better -- just when the adaptation was
going to be done implicitly (e.g. by type declarations).

When no state is involved, adapting an object multiple times can be
guaranteed to produce the same adapted object, so if this happens
implicitly, it's not a big deal.  When state is involved, _some_
decisions have to be made, and it seems like those decisions should be
made explicitly...

Steve
--
You can wordify anything if you just verb it.
       --- Bucky Katt, Get Fuzzy


More information about the Python-Dev mailing list