Alternate Syntax for dictionary elements
Aahz Maruch
aahz at panix.com
Wed Jul 4 10:45:45 EDT 2001
In article <LNz07.1653$h45.11048 at news.uk.colt.net>,
Graham Ashton <graham at coms.com> wrote:
>In article <3b421cec.5073656 at news.t-online.de>, "Gerson Kurz"
><gerson.kurz at t-online.de> wrote:
>>
>> 2 reasons for using dicts rather than classes:
>>
>> - You can easily create the data an object stores *dynamically*, i.e.
>> from user input.
>
>What can you do dynamically with a dictionary that you can't do with
>setattr() and getattr()? (that's a real question, not a cocky way of
>pointing out you might have missed something)
Well, you can use any immutable type as the key.
--
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista
"I'm not tense, i'm just terribly, terribly alert" --unknown
More information about the Python-list
mailing list