> 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