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/025570.html below:

[Python-Dev] PEP 292, Simpler String Substitutions

[Python-Dev] PEP 292, Simpler String SubstitutionsFredrik Lundh fredrik@pythonware.com
Wed, 19 Jun 2002 09:05:00 +0200
Barry wrote:

> def birth(self, name):
>     country = self.countryOfOrigin['name']
>     return '${name} was born in ${country}'.sub()

now explain why the above is a vast improvement over:

    def birth(self, name):
        country = self.countryOfOrigin['name']
        return join(name, ' was born in ', country)

(for extra bonus, explain how sub() can be made to
execute substantially faster than a join() function)

</F>





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