Idiosyncratic python

Steven D'Aprano steve at pearwood.info
Fri Sep 25 02:55:09 CEST 2015


On Fri, 25 Sep 2015 06:46 am, Ned Batchelder wrote:

> On Thursday, September 24, 2015 at 2:02:38 AM UTC-4, Steven D'Aprano
> wrote:
>> What are your favorite not-wrong-just-weird Python moments?
> 
> I've seen this a number of times:
> 
>     dict_of_values.update({'key': some_value})
> 
> why not:
> 
>     dict_of_values['key'] = some_value
> 
> I've considered writing a Pylint plugin to flag these...

Awesome! 

I haven't seen it in the wild, but there's this too:

    dict_of_values.update(key=some_value)



-- 
Steven



More information about the Python-list mailing list