Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82572 > unrolled thread
| Started by | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| First post | 2014-12-16 13:31 +1100 |
| Last post | 2014-12-16 13:31 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Portable code: ‘from __future__ import unicode_literals’ a good idea? Ben Finney <ben+python@benfinney.id.au> - 2014-12-16 13:31 +1100
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2014-12-16 13:31 +1100 |
| Subject | Re: Portable code: ‘from __future__ import unicode_literals’ a good idea? |
| Message-ID | <mailman.16993.1418697119.18130.python-list@python.org> |
Ned Batchelder <ned@nedbatchelder.com> writes: > 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." Who's saying there's anything wrong with that? Not I. My question is, what's wrong with the first part such that Devin recommends against it? > Also, keep in mind, these recommendations are not infallible. Yes, Devin clears up in a later message that the official guide provides no advice for the case where an API needs ‘bytes’ in Python 2 but Unicode in Python 3. > Be flexible. Do what works. Good advice, but nothing different from what I'm already trying to do. -- \ “[R]ightful liberty is unobstructed action, according to our | `\ will, within limits drawn around us by the equal rights of | _o__) others.” —Thomas Jefferson, 1819 | Ben Finney
Back to top | Article view | comp.lang.python
csiph-web