Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82553 > unrolled thread
| Started by | Zachary Ware <zachary.ware+pylist@gmail.com> |
|---|---|
| First post | 2014-12-15 01:39 -0600 |
| Last post | 2014-12-15 01:39 -0600 |
| 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: __import__ demands different string types between 2 and 3 Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-12-15 01:39 -0600
| From | Zachary Ware <zachary.ware+pylist@gmail.com> |
|---|---|
| Date | 2014-12-15 01:39 -0600 |
| Subject | Re: Portable code: __import__ demands different string types between 2 and 3 |
| Message-ID | <mailman.16976.1418629204.18130.python-list@python.org> |
On Mon, Dec 15, 2014 at 1:29 AM, Ben Finney <ben+python@benfinney.id.au> wrote:
> How can I get that ‘__import__’ call, complete with its ‘fromlist’
> parameter, working correctly under both Python 2 and Python 3, keeping
> the ‘unicode_literals’ setting?
How about "str('bar')"?
> If some kind of kludge is needed to make it work between versions, is
> this a bug which should be fixed so “use Unicode for text” remains
> applicable advice?
Fixed in which version? The problem is that Python 2 mixes the
notions of strings and bytestrings, and the solution is Python 3.
I believe six also has a "give me a native string" function to help with this.
--
Zach
Back to top | Article view | comp.lang.python
csiph-web