[Python-Dev] Re: Alternative Implementation for PEP 292:Simple String Substitutions (original) (raw)
Paul Moore pf_moore at yahoo.co.uk
Sun Sep 5 18:13:57 CEST 2004
- Previous message: [Python-Dev] Re: Alternative Implementation for PEP 292:Simple String Substitutions
- Next message: [Python-Dev] Isn't the trunk still frozen?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 , 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
- Previous message: [Python-Dev] Re: Alternative Implementation for PEP 292:Simple String Substitutions
- Next message: [Python-Dev] Isn't the trunk still frozen?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]