Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64114
| Path | csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; "'a'": 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'strings.': 0.09; 'valueerror:': 0.09; 'python': 0.11; 'jan': 0.12; 'keyerror': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:Unicode': 0.16; 'valueerror': 0.16; 'wrote:': 0.18; 'seems': 0.21; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'instance,': 0.24; 'unicode': 0.24; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'fixed': 0.29; 'am,': 0.29; 'raise': 0.29; 'unix': 0.29; "doesn't": 0.30; "i'm": 0.30; '"",': 0.31; '>>>>': 0.31; 'exceptions': 0.31; 'keyerror:': 0.31; 'file': 0.32; '(most': 0.33; 'problem': 0.35; 'there': 0.35; 'machine.': 0.36; 'hi,': 0.36; 'handle': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'received:173': 0.61; 'anything.': 0.68; 'hand': 0.80; 'received:fios.verizon.net': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: Unicode strings as arguments to exceptions |
| Date | Thu, 16 Jan 2014 18:09:20 -0500 |
| References | <20140116123408.GA5524@doriath.local> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | quoted-printable |
| X-Gmane-NNTP-Posting-Host | pool-173-75-254-207.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| In-Reply-To | <20140116123408.GA5524@doriath.local> |
| 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.5610.1389913787.18130.python-list@python.org> (permalink) |
| Lines | 41 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1389913787 news.xs4all.nl 2923 [2001:888:2000:d::a6]:32990 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:64114 |
Show key headers only | View raw
On 1/16/2014 7:34 AM, Ernest Adrogué wrote:
> Hi,
>
> There seems to be some inconsistency in the way exceptions handle Unicode
> strings. For instance, KeyError seems to not have a problem with them
>
>>>> raise KeyError('a')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> KeyError: 'a'
>>>> raise KeyError(u'ä')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> KeyError: u'\xe4'
>
> On the other hand ValueError doesn't print anything.
>
>>>> raise ValueError('a')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ValueError: a
>>>> raise ValueError(u'ä')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ValueError
>
> I'm using Python 2.7.6 on a Unix machine.
Fixed at some point in 3.x. In 3.4b2:
>>> ValueError(b'a')
ValueError(b'a',)
>>> ValueError('a')
ValueError('a',)
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Unicode strings as arguments to exceptions Terry Reedy <tjreedy@udel.edu> - 2014-01-16 18:09 -0500
csiph-web