Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82569
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'puts': 0.07; 'subject:code': 0.07; '"or': 0.09; 'mind,': 0.09; 'prefix': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'works.': 0.09; 'python': 0.11; '__future__': 0.16; 'finney': 0.16; 'literal.': 0.16; 'porting': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:import': 0.16; 'subject:skip:u 10': 0.16; 'wrote:': 0.18; 'solution.': 0.20; 'written': 0.21; 'import': 0.22; 'header:User-Agent:1': 0.23; 'received:comcast.net': 0.24; "shouldn't": 0.24; 'code:': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'specifically': 0.29; 'statement': 0.30; 'code': 0.31; 'compatible': 0.32; 'text': 0.33; 'url:python': 0.33; 'advice': 0.35; 'add': 0.35; 'subject:?': 0.36; 'url:org': 0.36; 'should': 0.36; 'wrong': 0.37; 'so,': 0.37; 'sometimes': 0.38; 'ben': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'url:3': 0.61; "you're": 0.61; 'you.': 0.62; "you'll": 0.62; 'such': 0.63; 'url:4': 0.69; 'subjectcharset:utf-8': 0.72; 'programs,': 0.74; 'subject:good': 0.84; 'subject::': 0.85 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Ned Batchelder <ned@nedbatchelder.com> |
| Subject | Re: Portable code: ‘from __future__ import unicode_literals’ a good idea? |
| Date | Mon, 15 Dec 2014 20:19:54 -0500 |
| References | <85wq5tpe0g.fsf@benfinney.id.au> <CABicbJKZ9XhhXAwQZrHrb8HUa-4QoKf5jT96msNxeuoDbMzVSg@mail.gmail.com> <85oar4pgrn.fsf_-_@benfinney.id.au> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | c-50-133-228-126.hsd1.ma.comcast.net |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| In-Reply-To | <85oar4pgrn.fsf_-_@benfinney.id.au> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16990.1418692803.18130.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1418692803 news.xs4all.nl 2858 [2001:888:2000:d::a6]:51637 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:82569 |
Show key headers only | View raw
On 12/15/14 7:42 PM, Ben Finney wrote: > As for the advice to avoid such a declaration, you're arguing against > the official guide for porting Python 2 code to 2-and-3 compatible code: > > For text you should either use the from __future__ import > unicode_literals statement or add a u prefix to the text literal. > > <URL:https://docs.python.org/3.4/howto/pyporting.html#text-versus-binary-data> > > So, the declarative import is specifically recommended. You'll need to > present a case for why I shouldn't follow that recommendation. What's wrong with this part of the recommendation?: "or add a u prefix to the text literal." Also, keep in mind, these recommendations are not infallible. They are sometimes written before there's been broad experience with the solution. Your use of __import__ puts you in a tiny minority of programs, so the recommendation that's good for 99% of code may not work for you. Be flexible. Do what works. -- Ned Batchelder, http://nedbatchelder.com
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Portable code: ‘from __future__ import unicode_literals’ a good idea? Ned Batchelder <ned@nedbatchelder.com> - 2014-12-15 20:19 -0500 Re: Portable code: 'from __future__ import unicode_literals' a good idea? wxjmfauth@gmail.com - 2014-12-16 00:19 -0800
csiph-web