A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-May/089497.html below:

[Python-Dev] PEP 383 update: utf8b is now the error handler

[Python-Dev] PEP 383 update: utf8b is now the error handler"Martin v. Löwis" martin at v.loewis.de
Thu May 7 19:21:58 CEST 2009
>> Well, there is a way to stack error handlers, although it's not pretty:
>> [...]
>> codecs.register_error("surrogates_then_replace",
>>                      surrogates_then_replace)
> 
> That mitigates my arguments significantly, although I'd rather see
> something like errors=('surrogates', 'replace') chain the handlers
> without additional registrations. But that's a different PEP or
> arbitrary change. :)

I think you can provide something like

errors=combine_errors('surrogates', 'replace')

as a library function, and it doesn't have to be part of the
standard library.

>>> The stacking argument also applies to the new utf8b behavior on encode
>>> (only, as it handles all errors on decode). This may be a YAGNI
>> Indeed - in particular, as, in the primary application of this error
>> handler (i.e. file IO operations), there is no way of specifying
>> an addition error handler anyway.
> 
> Would it be useful to allow setting this somewhere?

I'm deliberately not proposing this as part of the PEP. First, it
has enough features already, and is approved as-is; plus YAGNI.

Regards,
Martin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4