The Voidspace Techie Blog

Gravatar Granted, I'm biased, since I was the one who suggested the PEP 292-style interpolation. But the post above illustrates one good reason why ${foo} is better than %(foo)s. The "s" is far too easy to forget -- your example "foodir = %(something)" forgets it, in fact.

Just thought that was nicely ironic.


Gravatar *doh* - it will be corrected next time I upload.

I think our problems with recursive substitution could be easily solved by not doing recursive substitution...


Gravatar There is always the possibility of rejecting recursive interpolation, yes. But I think the patch I submitted on the mailing list finally gets it completely *right*, and I think it's a valuable feature:

rootpath = /home/rmunn/my_app
datapath = $rootpath/data
configfile = $datapath/config.ini
extraspath = $datapath/extras
demofile = $extraspath/screencast.avi

Then if while running you need to change rootpath, you can set it to "/home/rmunn/elsewhere" and the other paths will follow along.

That's the reason for recursive interpolation: to allow something like this. This isn't a convoluted example like the ones I used to test my patch; this is a use case I would actually *use*. This sort of thing is precisely what motivated me to submit this patch in the first place.


Name:

Email:

URL:

Comment:  ? 

 

Commenting by HaloScan