Pythonic list/tuple/dict layout?

Dan Bishop danb_83 at yahoo.com
Sun Jan 25 03:51:24 EST 2009


On Jan 25, 2:18 am, Akira Kitada <akit... at gmail.com> wrote:
> Hi,
>
> There is more than one way to write a list/tuple/dict in Python,
> and actually different styles are used in standard library.
> As a hobgoblin of little minds, I rather like to know which style is
> considered "Pythonic"
> in the community.
>
> I collected common layout from existing code and pasted them below.
> My vote would go to d1. How about yours?
>
> If there is consensus on this, that might be worth being included in PEP 8.
>
> Thanks,
>
> """
> d1 = {
>     0: "ham",
>     1: "jam",
>     2: "spam",
>     3: "alot",
>     4: "knights",
>     5: "who",
>     6: "say",
>     7: "ni",
>     8: "dead",
>     9: "parrot",
>
> }
> [snip]

I use d1.

Wow!  A Python debate over curly brace placement!  Imagine that!



More information about the Python-list mailing list