[Python-Dev] dict() enhancement idea? (original) (raw)

Barry A. Warsaw barry@python.org
Thu, 21 Nov 2002 12:36:14 -0500


"JvR" == Just van Rossum <just@letterror.com> writes:

>> Where _() does a sys._getframe() and automatically sucks the
>> locals and globals for interpolation.  Works great, but it
>> gives pychecker fits. :)

JvR> You, my friend, are a sick man! But then again, I already
JvR> knew that ;-)

You've read my poems. :)

>> I like both the **kws addition as well as the
>> keywords-as-attributes conveniences.

JvR> I wouldn't propose the latter seriously as an enhancement to
JvR> the dict object: imagine all the c.l.py posts we'll get of
JvR> people who do

>> d = {} d.keys = <whatever>

JvR> and wonder why it blows up later... What Oren posted is a
JvR> great hack in cases where you more or less know the kind of
JvR> keys you're going to expect, but it isn't as great as a
JvR> general feature of dicts.

Completely agreed! I tried to weasel word that in a way to say I like those for some applications, but not necessarily as part of dicts.

-Barry