In article <871vur39k7@benfinney.id.au>,
Ben Finney wrote:
>
>I actually use this style:
>
>foo = {
>0: 'spam',
>1: 'eggs',
>2: 'beans',
>}
>
>because that makes it clear that *all* the indented lines are a
>continuation of the same statement, just like a s
Akira Kitada writes:
> I collected common layout from existing code and pasted them below.
> My vote would go to d1. How about yours?
It seems that I use both d1 and d4, though in both cases I omit the
trailing commas. I use d1 when each item is on a separate line, and d4
when I'm packing them
d1
--
http://mail.python.org/mailman/listinfo/python-list
> These are the only two that follow PEP 8; the others don't have
> four-space indent levels.
In those examples, the following sentence in PEP 8 would be applied.
"Make sure to indent the continued line appropriately."
> I actually use this style:
>
>foo = {
>0: 'spam',
>1: '
> BTW, there's no need to use such large examples. Three items per dict
> would be sufficient to illustrate the styles, using ten items doesn't add
> anything useful to the discussion.
I worried to be told
'you can make it in a line like {"ham": "jam", "spam": "alot"}'
;)
--
http://mail.python.org
On Sun, 25 Jan 2009 17:18:28 +0900, Akira Kitada 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
Akira Kitada writes:
> 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",
When the date was Sunday 25 January 2009, Akira Kitada wrote:
> There is more than one way to write a list/tuple/dict in Python,
> and actually different styles are used in standard library.
I would vote for d1, but I don't think that this is more "pythonic", I just
consider it more "clean", acc
> Wow! A Python debate over curly brace placement! Imagine that!
PEP8 even deals with tabs vs spaces, where to put a blank line, etc :)
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 25, 2:18 am, Akira Kitada 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
> and pasted them below.
> My vote would go to d1. How about yours?
>
>
Whatever reads best within the context of the specific code is Pythonic.
--
http://mail.python.org/mailman/listinfo/python-list
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 the
12 matches
Mail list logo