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/2002-June/025595.html below:

PEP 292, Simpler String Substitutions

[Python-Dev] Re: PEP 292, Simpler String SubstitutionsGuido van Rossum guido@python.org
Wed, 19 Jun 2002 08:52:38 -0400
> Have you considered the possibility of accepting keyword arguments
> instead?  They would be slightly more pleasant to write:
> 
>         print s.sub(name='Guido', country='the Netherlands')
> 
> This is motivated because i imagine relative frequencies of use
> to be something like this:
> 
>     1.  sub()                      [most frequent]
>     2.  sub(name=value, ...)       [nearly as frequent]
>     3.  sub(dictionary)            [least frequent]
> 
> If you decide to use keyword arguments, you can either allow both
> keyword arguments and a single dictionary argument, or you can
> just accept keyword arguments and people can pass in dictionaries
> using **.

I imagine that the most common use case is a situation where the dict
is already prepared.  I think **dict is slower than a positional dict
argument.  I agree that keyword args would be useful in some cases
where you can't trust the string.

--Guido van Rossum (home page: http://www.python.org/~guido/)




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