[Python-Dev] Re: A small proposed change to dictionaries' "get" method

Martijn Faassen m.faassen at vet.uu.nl
Thu Aug 3 13:41:48 EDT 2000


M.-A. Lemburg <mal at lemburg.com> wrote:
> "Barry A. Warsaw" wrote:
>> 
>> >>>>> "M" == M  <mal at lemburg.com> writes:
>> 
>>     M> The following one-liner already does what you want:
>> 
>>     M>  d[word] = d.get(word, []).append('world')
>> 
>>     M> ... and it's in no way more readable than your proposed
>>     M> .put() line ;-)
>> 
>> Does that mean it's less readable?  :)

> I find these .go_home().get_some_cheese().and_eat()...
> constructions rather obscure.

But as pointed out, this construction doesn't even work; even though
I and you and Barry all tripped over it. append() really returns None. :)

Readable-or-not-it-doesn't-work-ly yours,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list