[Python-ideas] [Python-Dev] User conversions in custom string.Formatter
Andrew Svetlov
andrew.svetlov at gmail.com
Wed Mar 16 02:51:10 CET 2011
On Wed, Mar 16, 2011 at 3:48 AM, Andrew Svetlov
<andrew.svetlov at gmail.com> wrote:
> I can, but .parse() is thin wrapper around _string.formatter_parser,
> which is implemented in C
> (Objects/stringlib/string_format.h) and is opaque structure from python side.
> To override .parse() I should to reimplement the most part of this file.
>
> It's much easier to patch 'parse_field' and 'MarkupIterator_next'
> functions than reimplement all existing functionality.
>
Also please note I can easy override string.Formatter.format_field if
need (while generally it's not required,
__format__ works very well) but it's very hard to override .parse.
More information about the Python-ideas
mailing list