Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)
Mark H Harris
harrismh777 at gmail.com
Tue Apr 1 19:18:32 EDT 2014
On 4/1/14 4:49 PM, Chris Angelico wrote:
> On Wed, Apr 2, 2014 at 8:26 AM, Mark H Harris <harrismh777 at gmail.com> wrote:
>> Python3 finally started getting unicode right. The fact that it 'existed'
>> in some form prior to (3) is not meaningful, nor helpful.
>> When I said, "python has only really used it since python3, right?," I meant
>> that unicode in python2 was a mess (and incomplete, and I could go on) but
>> finally---in python3---it is becoming useful (even though it still has
>> glitches). I don't know why we need to argue about it.
>
> Please elaborate. Apart from the default double-quoted string being a
> byte string (which can be changed with a future directive), and the
> consequent likelihood that library functions will expect str rather
> than unicode, what was such an incomplete mess in Py2 that made
> Unicode completely useless? Personally, I'd still rather work with
> Unicode in Py2 than in C, REXX, or any other completely Unicode-naive
> language.
>
> ChrisA
>
hi Chris, oh good, another chance to be entirely misinterpreted; thanks. :)
I think I will defer to another person in an attempt to keep the
emotions, rhetoric, and politics out of the answer. This link is not
inclusive, but its a good reminder ( for those new to the topic ) of
what was *wrong* with python2 unicode (still is wrong with python2
unicode) although it focuses on the positives of what is new in python3:
> http://python-notes.curiousefficiency.org/en/latest/python3/text_file_processing.html
Um, 'mess' might be too harsh a word. But in my view text processing in
python is a bit of a mess in python2 (particularly concerning unicode).
In my opinion python3 has made some fairly dramatic improvements, that
help to make text file processing (something I do a lot of) more
consistent and easier to manage (relatively new to unicode as I am).
Something that should be noted is that unicode is only as good as
commitment 'does'. ASCII is still used. Sometimes (often) unicode is
being used 'as though' ASCII were still there ruling. Unicode usage
requires commitment to use and implementation. My hat is off to the
python core development team for stepping up to the plate with their
changes to python3 text processing issues.
That's all I really want to say about it. Read the link, but don't argue
with me; its not that important and too many folks get upset by it.
marcus
More information about the Python-list
mailing list