[Python-Dev] PEP 246, redux

Nick Coghlan ncoghlan at iinet.net.au
Thu Jan 13 17:03:57 CET 2005


Carlos Ribeiro wrote:
> On Thu, 13 Jan 2005 10:08:10 -0500, Phillip J. Eby
> <pje at telecommunity.com> wrote:
> 
>>With the previous PEP, people could create all sorts of subtle problems in
>>their code (with or without transitivity!) and have no direct indicator of
>>a problem.  Clark and Ian made me realize this with their string/file/path
>>discussions -- *nobody* is safe from implicit adaptation if adaptation
>>actually creates new objects with independent state!  An adapter's state
>>needs to be kept with the original object, or not at all, and most of the
>>time "not at all" is the correct answer.
> 
> 
> +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.

+lots

Now that it's been stated, I think this is similar to where implicit type 
conversions in C++ go wrong, and to the extent that PEP 246 aligns with those. . 
. *shudder*.

I've also learned from this discussion just how wrong my own ideas about how to 
safely use adaptation were. Most Python programmers aren't going to have the 
benefit of listening to some smart people work through the various issues in public.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net


More information about the Python-Dev mailing list