21 Nov
2002
21 Nov
'02
9:40 p.m.
Barry A. Warsaw wrote:
name1 = foo() name2 = foo() x = _(template)
Where _() does a sys._getframe() and automatically sucks the locals and globals for interpolation. Works great, but it gives pychecker fits. :)
You, my friend, are a sick man! But then again, I already knew that ;-)
I like both the **kws addition as well as the keywords-as-attributes conveniences.
I wouldn't propose the latter seriously as an enhancement to the dict object: imagine all the c.l.py posts we'll get of people who do
d = {} d.keys = <whatever>
and wonder why it blows up later... What Oren posted is a great hack in cases where you more or less know the kind of keys you're going to expect, but it isn't as great as a general feature of dicts. Just