A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-September/048967.html below:

[Python-Dev] python-dev Summary for 2004-08-16 through 2004-08-31 [draft]

[Python-Dev] python-dev Summary for 2004-08-16 through 2004-08-31 [draft] [Python-Dev] python-dev Summary for 2004-08-16 through 2004-08-31 [draft]Brett C. bac at OCF.Berkeley.EDU
Thu Sep 16 18:41:15 CEST 2004
Erik Heneryd wrote:
> Brett C. wrote:
> 
>> The second issue was other the design of the API.  Originally Template 
>> was a class that overrode __mod__ to make it work like string 
>> interpolation works now for str and unicode.  But then some people 
>> felt a class was too heavy-handed if there was no way to change the 
>> way Template worked through a subclass.  This obviously led to a 
>> desire for functions to do the work for both Template and SafeTemplate 
>> (similar class to Template that left in substitution points if they 
>> didn't match any values in the dict passed in).
>>
>> In the end the class design was kept thanks to Tim Peters and 
>> metaclasses.  Tim came up with a neat way to have the regex be 
>> generated at class creation time through a metaclass and thus allow 
>> subclasses to change how Template matched substitution points and 
>> such, all without a performance hit at instance creation time.  Use of 
>> __mod__ and the SafeTemplate class were removed and Template grew 
>> substitute and safe_substitute methods.  Everyone at this point seems 
>> happy with the design.
> 
> 
> Well, not *everyone*.

OK, it now says "practically everyone".  =)

-Brett
More information about the Python-Dev mailing list

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