
On Wed, Feb 11, 2009 at 5:09 AM, Lie Ryan <lie.1296@gmail.com> wrote:
On Wed, Feb 11, 2009 at 7:41 PM, Adam Olsen <rhamph@gmail.com> wrote:
Exposing a dict API would pollute namedtuple.
What do you mean by "pollute namedtuple"?
I just mean that we don't want to add a bunch of extra options and features that'll only be appropriate for rare special cases.
What's more, it's unnecessary in python 2.6/3.0:
print('one = {0.x}, two = {0.y}'.format(nt)) one = 12, two = 32
(And before you ask, no, I don't think it's worth adding the dict API just to make old-style formatting a tiny bit easier.)
Is % interpolation deprecated? I've never heard of that...
There's no plans to remove it in the near future, so it's not deprecated, and there's no problem using it when it's convenient. However, .format() obsoletes it. .format() is significantly more powerful for reasons just like this. There's no reason to add new features to % interpolation with .format() around. -- Adam Olsen, aka Rhamphoryncus