On Wed, 2004-08-11 at 08:06, Fernando Perez wrote: > If I understood things correctly, this proposal will not allow the evaluation of > any kind of expression, including attributes. With the existing interpolation > system, the following happens: > > In [2]: print 'sys.platform is: %(sys.platform)s' % locals() > --------------------------------------------------------------------------- > KeyError Traceback (most recent call last) > > ? > > KeyError: sys.platform You don't mean the 'existing' interpolation system, because this obviously doesn't work in Python today, although with a fancy enough implementation of 'locals()', it could. That actually doesn't change much with PEP 292. I specifically designed it so that you could subclass from template, so as to accept the extended placeholder syntax (i.e. dots), and then implement a mapping-like class to do the lookups in any namespace you want. In fact, my earlier implementation contained such a class, but it was deemed too complex to win the name 'simpler' so it was left out of the library. It's a trivial amount of code and my own personal use case has a need for such a feature. -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 307 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/python-dev/attachments/20040811/ca79d64c/attachment-0001.pgp
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