Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; '(b)': 0.07; 'incompatible': 0.07; 'converted': 0.09; 'parameter': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'jan': 0.12; '__future__': 0.16; 'backwards': 0.16; 'defined,': 0.16; 'directive': 0.16; 'easier.': 0.16; 'other)': 0.16; 'wrote:': 0.18; 'module': 0.19; 'first.': 0.19; 'stack': 0.19; 'cc:addr:python.org': 0.22; '(a)': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'suggested': 0.26; 'second': 0.26; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; '(c)': 0.29; 'said,': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'getting': 0.31; 'class': 0.32; 'running': 0.33; 'cases': 0.33; 'actual': 0.34; 'skip:_ 10': 0.34; 'maybe': 0.34; 'subject:the': 0.34; 'could': 0.34; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'are,': 0.36; 'complete.': 0.36; 'instances': 0.36; 'transition': 0.36; 'done': 0.36; 'doing': 0.36; 'skip:o 20': 0.38; 'issue': 0.38; 'fact': 0.38; 'pm,': 0.38; 'little': 0.38; 'does': 0.39; 'is.': 0.60; 'problems.': 0.60; 'conversion': 0.61; 'lower': 0.61; 'address': 0.63; 'kind': 0.63; 'to:addr:gmail.com': 0.65; 'move.': 0.84; 'moves': 0.84; 'wholesale': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=OOcnv+2WtRgDWEO6AMGwYBwPmihWeXCgF1DTcKJWKMc=; b=Fxw9f03fMoaudN4CV5GlNrZ7YcSjGVe9oN2ss0EtzJFkntjctOKmw2SbaVS+REhFdc cREl1NKtXdYCqs+4R4hz1hMUfzNgRZNjGjEeYAU4/apYeYiDlqiXHliVHxKmj5jFcpY0 f6ibQyxoP94O5lqcIwgFTiBIcc2g531EIfNYQa1ee6u0lqPmjfvpZb8lMHJrK8eZ5aTg jcQZAJroUXq9veWZZhLpgV13H1BjP5s2Oh/CE1TDafDLQtgRP/wDIATxIJuEBhvTkCjK nYXe7txM+nENRCJqkNuTO3bMg99ngjaRhPO7PQiS3xc1a7GHg9Ia4Uu/C26EAQp7TQoF 5xeQ== X-Received: by 10.49.28.166 with SMTP id c6mr191893997qeh.80.1389064365380; Mon, 06 Jan 2014 19:12:45 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Devin Jeanpierre Date: Mon, 6 Jan 2014 19:12:05 -0800 Subject: Re: the Gravity of Python 2 To: Chris Angelico Content-Type: text/plain; charset=UTF-8 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1389064367 news.xs4all.nl 2872 [2001:888:2000:d::a6]:58169 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63407 On Mon, Jan 6, 2014 at 6:28 PM, Chris Angelico wrote: > class Foo(str): > def __add__(self, other): > if isinstance(other, unicode): return self + other.encode("cp500") > return str.__add__(self, other) > > What happens if you have the __future__ directive disabling > autoencoding on (a) the module in which this class is defined, (b) the > one in which the it was instantiated, (c) the one that actually uses > the +? In both methods I described, all uses of instances of the class are changed, but only in case A. That's a really good point, I hadn't considered that the second case could be converted into the first. > This is why I think it's getting magical. Yes, it's magical, but to be fair that's stack inspection as it always is. I am OK with a little ugliness if it makes actual work easier. > Far better to do this sort > of change on a per-application basis - maybe with a warning parameter > that you can enable when running your test suite, as has been > suggested (and in many cases implemented) for other 2-vs-3 problems. Doing a flag like that that enables a backwards incompatible change does in fact address that issue you were worried about originally, so that's something. And feature-by-feature moves are, like the OP said, still lower cost than a wholesale move. In the end a gradual transition can still be done with the polyglot approach, but I'm not happy that there's no way to enforce/test a polyglot conversion until it is complete. Any kind of granularity would have helped. :( -- Devin