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

[Python-Dev] Re: Alternative Implementation for PEP 292:Simple String Substitutions

[Python-Dev] Re: Alternative Implementation for PEP 292:Simple String Substitutions [Python-Dev] Re: Alternative Implementation for PEP 292:Simple String SubstitutionsPaul Moore pf_moore at yahoo.co.uk
Sun Sep 5 18:13:57 CEST 2004
Tim Peters <tim.peters at gmail.com> writes:

> [Paul Moore]
>>> Would it be useful to factor out the "identifier syntax" bit of the
>>> pattern? The "escaped" and "bogus" groups are less likely to need
>>> changing than what constitutes an identifier.
>  
> [Barry Warsaw]
>> And if they did, you'd want to change them both at the same time.  Do
>> you have any ideas for an efficient, easily documented implementation?
>
> You'll rarely hear me say this <wink>, but fiddling classes at class
> creation time is exactly what metaclasses are for.  For example,
> suppose you said a Template subclass could define a class variable
> `idpat`, containing a regexp matching that subclass's idea of "an
> identifier".
>
> Then we could define a metaclass once-and-for-all, like so:

[...]

That's exactly the type of implementation I was thinking about, but
didn't have the knowledge to implement myself! Thanks for doing my
thinking for me, Tim :-)

Paul.
-- 
The major difference between a thing that might go wrong and a thing
that cannot possibly go wrong is that when a thing that cannot
possibly go wrong goes wrong it usually turns out to be impossible to
get at or repair. -- Douglas Adams

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