[Python-Dev] Sets, Dictionaries

Eric Fahlgren ericfahlgren at gmail.com
Thu Mar 29 14:15:01 EDT 2018


On Thu, Mar 29, 2018 at 10:11 AM, David Mertz <mertz at gnosis.cx> wrote:

> I agree with everything Steven says. But it's true that even as a 20-year
> Python user, this is an error I make moderately often when I want an empty
> set... Notwithstanding that I typed it thousands of times before sets even
> existed (and still type it when I want an empty dictionary).
>
> That said, I've sort of got in the habit of using the type initializers:
>
> x = set()
> y = dict()
> z = list()
>
> I feel like those jump out a little better visually. But I'm inconsistent
> in my code.
>

​
Yeah, we've been doing that for several years, too.  A hair slower in some
cases, but much more greppable...

​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180329/6aa9239a/attachment.html>


More information about the Python-Dev mailing list