[Python-Dev] Re: Re: Update PEP 292 (original) (raw)

Barry Warsaw barry at python.org
Wed Aug 18 06:23:00 CEST 2004


On Wed, 2004-08-11 at 10:54, Fernando Perez wrote:

I guess my post wasn't worded too clearly. I did mean existing, in the sense that the error above occurs with current python (it's cut-and-paste from python 2.2). My point was precisely to illustrate this failure with a simple example, to then ask whether the new scheme could be made, as shipped, to accept this kind of expansion:

print template('sys.platform is: $sys.platform') % locals()

Not as shipped. You'd have you derive from the Template class and write a regular expression (or adapt the existing pattern).

It may be trivial to extend pep-292 for this, but not having to do it in every small utility you write/ship would be very useful, IMHO. If there are no technical reasons to prevent it, is the 'too complex' argument really that strong (especially since you state it's a trivial amount of code)?

Well, it's about 3 lines of Python, but what would you call the class, AttributeTemplate? I wouldn't be opposed to adding the class, since I think it would be pretty useful.

-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/20040818/62a441f5/attachment.pgp



More information about the Python-Dev mailing list