[Python-Dev] Proposal: defaultdict
"Martin v. Löwis"
martin at v.loewis.de
Sat Feb 18 00:06:20 CET 2006
More information about the Python-Dev mailing list
Sat Feb 18 00:06:20 CET 2006
- Previous message: [Python-Dev] Proposal: defaultdict
- Next message: [Python-Dev] Proposal: defaultdict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ian Bicking wrote: > I know *I* at least don't like code that mixes up access and > modification. Maybe not everyone does (or maybe not everyone thinks of > getitem as "access", but that's unlikely). I will assert that it is > Pythonic to keep access and modification separate, which is why methods > and attributes are different things, and why assignment is not an > expression, and why functions with side effects typically return None, > or have names that are very explicit about the side effect, with names > containing command verbs like "update" or "set". All of these > distinguish access from modification. Do you never write d[some_key].append(some_value) This is modification and access, all in a single statement, and all without assignment operator. I don't see the setting of the default value as a modification. The default value has been there, all the time. It only is incarnated lazily. Regards, Martin
- Previous message: [Python-Dev] Proposal: defaultdict
- Next message: [Python-Dev] Proposal: defaultdict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list