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/2004-September/048694.html below:

Alternative Implementation for PEP292:SimpleString Substitutions

[Python-Dev] Re: Alternative Implementation for PEP292:SimpleString Substitutions [Python-Dev] Re: Alternative Implementation for PEP292:SimpleString SubstitutionsGuido van Rossum gvanrossum at gmail.com
Wed Sep 8 17:08:07 CEST 2004
> Templates are meant to template *text* data, so Unicode is
> the right choice of baseclass from a design perspective.

Only in Python 3.0.

But even so, deriving from Unicode (or str) means the template class
inherits a lot of unwanted operations. While I can see that
concatenating templates probably works, slicing them or converting to
lowercase etc. make no sense. IMO the standard Template class should
implement a "narrow" interface, i.e. *only* the template expansion
method (__mod__ or something else), so it's clear that other
compatible template classes shouldn't have to implement anything
besides that. This avoids the issues we have with the mapping
protocol: when does an object implement enough of the mapping API to
be usable? That's currently ill-defined; sometimes, __getitem__ is all
you need, sometimes __contains__ is required, sometimes keys, rarely
setdefault.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
Ask me about gmail.
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