Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60427

Re: python for everyday tasks

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <torriem+gmail@torriefamily.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'programmer': 0.03; 'anyway.': 0.05; 'encoding': 0.05; 'correct.': 0.07; 'indexing': 0.07; 'utf-8': 0.07; 'string': 0.09; 'implements': 0.09; 'strings.': 0.09; 'used.': 0.09; 'python': 0.11; 'constructs.': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'internally': 0.16; 'itself,': 0.16; 'pairs': 0.16; 'silly': 0.16; 'slicing,': 0.16; 'subject:tasks': 0.16; 'surrogate': 0.16; 'tweak': 0.16; 'unicode.': 0.16; 'subject:python': 0.16; 'language': 0.16; 'wrote:': 0.18; "python's": 0.19; 'not,': 0.20; 'appears': 0.22; 'memory': 0.22; 'coding': 0.22; 'saying': 0.22; 'header:User- Agent:1': 0.23; 'byte': 0.24; 'switched': 0.24; 'unicode': 0.24; "haven't": 0.24; 'right.': 0.26; 'world,': 0.26; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'ideal': 0.29; 'posting': 0.31; 'concern': 0.31; "d'aprano": 0.31; 'this.': 0.32; 'languages': 0.32; 'another': 0.32; 'everyone': 0.33; 'programmers': 0.33; "i'd": 0.34; 'no,': 0.35; 'google': 0.35; 'himself': 0.36; 'largely': 0.36; 'reality': 0.36; 'scheme': 0.36; 'should': 0.36; 'message-id:@gmail.com': 0.38; 'handle': 0.38; 'to:addr:python- list': 0.38; 'fact': 0.38; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'algorithms': 0.60; 'full': 0.61; 'matter': 0.61; 'course': 0.61; 'save': 0.62; 'email addr:gmail.com': 0.63; 'different': 0.65; 'situation': 0.65; 'side': 0.67; 'real-world': 0.68; 'yourself': 0.78; 'beats': 0.84; 'confusing': 0.84; 'presumably': 0.84; 'seeds': 0.84; 'exposing': 0.91; 'why?': 0.91; 'choice.': 0.93; 'endorsed': 0.93; 'period.': 0.95
X-Virus-Scanned amavisd-new at torriefamily.org
Date Mon, 25 Nov 2013 08:11:22 -0700
From Michael Torrie <torriem@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130105 Thunderbird/10.0.12
MIME-Version 1.0
To python-list@python.org
Subject Re: python for everyday tasks
References <5737051f-26d4-4771-b4a0-d41062f1a4ef@googlegroups.com> <52900c74$0$29993$c3e8da3$5496439d@news.astraweb.com> <d41c02c1-22f4-477c-b4ad-79001f13e302@googlegroups.com>
In-Reply-To <d41c02c1-22f4-477c-b4ad-79001f13e302@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
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.3179.1385392311.18130.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1385392311 news.xs4all.nl 15879 [2001:888:2000:d::a6]:37012
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:60427

Show key headers only | View raw


I only respond here, as unicode in general is an important concept that
the OP will to make sure his students understand in Python, and I don't
want you to dishonestly sow the seeds of uncertainty and doubt.

On 11/25/2013 03:12 AM, wxjmfauth@gmail.com wrote:
> Your paragraph is mixing different concepts.

On the contrary, it appears you are the one mixing the concepts, and
confusing a byte-encoding scheme with unicode.

In an ideal world, the programmer should not need to know or care about
what encoding scheme the language is using internally to store strings.
 And it does not matter whether the internal encoding scheme is endorsed
by the unicode commission or not, provided it can handle all the valid
unicode constructs.

A string is unicode.  Period.  Hence you must concern yourself with
encoding only when reading or writing a byte stream.

Inside the language itself, the encoding is irrelevant.  Ideally.  In
python 3.3+ anyway.  Of course reality is different in other languages
which is why programmers are used to worrying about things like exposing
surrogate pairs (as Javascript does), or having to tweak your algorithms
to deal with the fact that UTF-8 indexing is not O(1).  To claim that a
programmer has to concern himself with internal language encoding in
Python 3 is not only untrue, it's ingenuousness at best, given the OP's
mission.

> When it comes to save memory, utf-8 is the choice. It
> beats largely the FSR on the side of memory and on
> the side of performances.

So you would condemn everyone to use an O(n) encoding for a string when
FSR offers full unicode compliance that optimizes both speed and memory?

No, D'Aprano is correct.  Python 3.3+ indeed does unicode right.  It
offers O(1) slicing, is memory efficient, and never exposes things like
surrogate pairs.

> How and why? I suggest, you have a deeper understanding
> of unicode.

Indeed I'd say D'Aprano does have a deeper understanding of unicode.

> May I recall, it is one of the coding scheme endorsed
> by "Unicode.org" and it is intensively used. This is not
> by chance.

Yes, you keep saying this.  Have you encountered a real-world situation
where you are impacted by Python's FSR? You keep posting silly
benchmarks that prove nothing, and continue arguing, yet presumably you
are still using Python.  Why haven't you switched to Google Go or
another language that implements unicode strings in UTF-8?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

python for everyday tasks koch.mate@gmail.com - 2013-11-22 15:59 -0800
  Re: python for everyday tasks Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-23 02:01 +0000
    Re: python for everyday tasks wxjmfauth@gmail.com - 2013-11-25 02:12 -0800
      Re: python for everyday tasks Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-25 13:33 +0000
      Re: python for everyday tasks Michael Torrie <torriem@gmail.com> - 2013-11-25 08:11 -0700
        Re: python for everyday tasks wxjmfauth@gmail.com - 2013-11-25 08:17 -0800
      Re: python for everyday tasks Chris Angelico <rosuav@gmail.com> - 2013-11-26 02:38 +1100
      Re: python for everyday tasks Ben Finney <ben+python@benfinney.id.au> - 2013-11-26 10:35 +1100
      Re: python for everyday tasks Chris Angelico <rosuav@gmail.com> - 2013-11-26 11:09 +1100
    Re: python for everyday tasks Pavel Volkov <negaipub@gmail.com> - 2013-11-27 22:05 +0400
    Re: python for everyday tasks Michael Torrie <torriem@gmail.com> - 2013-11-27 11:15 -0700
    Re: python for everyday tasks Chris Angelico <rosuav@gmail.com> - 2013-11-28 10:11 +1100
  Re: python for everyday tasks Ned Batchelder <ned@nedbatchelder.com> - 2013-11-22 18:32 -0800
  Re: python for everyday tasks Dan Stromberg <drsalists@gmail.com> - 2013-11-22 22:28 -0800
  Re: python for everyday tasks Dan Stromberg <drsalists@gmail.com> - 2013-11-22 22:36 -0800
  Re: python for everyday tasks Chris Angelico <rosuav@gmail.com> - 2013-11-23 18:25 +1100
    Re: python for everyday tasks koch.mate@gmail.com - 2013-11-23 16:54 -0800

csiph-web