Filip Gruszczyński wrote:
> I would appreciate any advice on this topic, even if this ticket would
> be dismissed altogether, as I would like to learn as much as possible
> on practices on developing Python.

Raymond's use case is valid, but the currently proposed method name is
way too long to be usable and the use of *args is a definite misfeature.

I suggest approaching the issue with the exact spec needed to cover the
problem Raymond described:

   Add a method to strings that allows a format string to
   be applied to an existing mapping without implicitly
   converting the mapping to a dict first.

From that spec, a straightforward API falls out:

    def format_mapping(self, kwds):
      # Method body actually written in C, so it can
      # easily invoke the internal formatting operation
      return do_string_format(self, NULL, kwds)

Sure, you can't mix positional and keyword arguments the way you can
with .format(), but you can't mix and match those with mod-formatting
either.

*If* support for a sequence were to be added (and that's a big if), it
should be added as an explicit second argument, not as a *args argument.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to