Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55486
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:error': 0.03; 'importing': 0.05; 'skip:e 50': 0.05; 'caller': 0.09; 'implements': 0.09; 'type,': 0.09; "wouldn't": 0.14; 'codec': 0.16; 'codecs': 0.16; 'dislike': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'handlers': 0.16; 'handlers.': 0.16; 'imports': 0.16; 'normally,': 0.16; 'registered.': 0.16; 'subject:API': 0.16; 'subject:Unicode': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'module': 0.19; 'mechanism': 0.19; 'not,': 0.20; 'import': 0.22; 'error': 0.23; 'equivalent': 0.26; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'that.': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'them?': 0.31; 'quite': 0.32; 'fri,': 0.33; "i'd": 0.34; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'right?': 0.36; 'words,': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'itself': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'worry': 0.60; 'name': 0.63; 'holding': 0.65; 'risk': 0.72; 'collision.': 0.84; 'detecting': 0.84; 'much,': 0.84; 'side- effects': 0.84; 'do:': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=K85tOC6YLlXGZ9OrgHcrk174b5lKE42dayLIncaT+24=; b=FYoAxQfhCjkGnmOIqNt/MEx3JXhRJODD2ebMTVKxOwGQ11pumU78UF535yvGF5JpBh onpM7iSyqk1zmjOUI9vFrBIgaKyPl0q2Jk244O3Eg34GZJ+G8omiS9uE7elkHbc1gE++ k3JqmKG+DdYpvMHQGvYQdhJ42EPUHGsQM1KWJ8AE0hbdHUKp5TVkDCaI6jw30lOv83Ib aMoy21qeOaZ3uK7uD3RsPO+x0m87nwd8eKyLbbW3r/M6gzgwrmzuM2QGi5zoCs30jcVf daxrWtZa0lpRjLY3Pdwt0yz376PBaUVIVAHgzYkMM5CPE7ZR3QtQambVbyaCq7gWMtlO fWqg== |
| MIME-Version | 1.0 |
| X-Received | by 10.66.163.164 with SMTP id yj4mr17039404pab.91.1380907368834; Fri, 04 Oct 2013 10:22:48 -0700 (PDT) |
| In-Reply-To | <524ec8fe$0$29984$c3e8da3$5496439d@news.astraweb.com> |
| References | <524ec8fe$0$29984$c3e8da3$5496439d@news.astraweb.com> |
| Date | Sat, 5 Oct 2013 03:22:48 +1000 |
| Subject | Re: API for custom Unicode error handlers |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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.727.1380907377.18130.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1380907377 news.xs4all.nl 15966 [2001:888:2000:d::a6]:33537 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:55486 |
Show key headers only | View raw
On Fri, Oct 4, 2013 at 11:56 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > Should the module holding the error handlers automatically register them? > In other words, if I do: > > import error_handlers > > just importing it will have the side-effect of registering the error > handlers. Normally, I dislike imports that have side-effects of this > sort, but I'm not sure that the alternative is better, that is, to put > responsibility on the caller to register some, or all, of the handlers: > > import error_handlers > error_handlers.register(error_handlers.namereplace_errors) > error_handlers.register_all() Caveat: I don't actually use codecs much, so I don't know the specifics. I'd be quite happy with importing having a side-effect here. If you import a module that implements a numeric type, it should immediately register itself with the Numeric ABC, right? This is IMO equivalent to that. > As far as I know, there is no way to find out what error handlers are > registered, and no way to deregister one after it has been registered. The only risk that I see is of an accidental collision. Having a codec registered that you don't use can't hurt (afaik). Is there any mechanism for detecting a name collision? If not, I wouldn't worry about it. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
API for custom Unicode error handlers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-04 13:56 +0000 Re: API for custom Unicode error handlers Chris Angelico <rosuav@gmail.com> - 2013-10-05 03:22 +1000 Re: API for custom Unicode error handlers Ethan Furman <ethan@stoneleaf.us> - 2013-10-04 11:05 -0700 Re: API for custom Unicode error handlers Serhiy Storchaka <storchaka@gmail.com> - 2013-10-04 22:08 +0300 Re: API for custom Unicode error handlers Serhiy Storchaka <storchaka@gmail.com> - 2013-10-04 22:35 +0300 Re: API for custom Unicode error handlers Terry Reedy <tjreedy@udel.edu> - 2013-10-04 18:44 -0400
csiph-web