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
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