← Back to team overview

openerp-community team mailing list archive

Re: Style: dictionaries

 

Le 4 déc. 2013 17:38, "Guewen Baconnier" <guewen.baconnier@xxxxxxxxxxxxxx>
a écrit :
>
> On 12/04/2013 05:24 PM, Leonardo Pistone wrote:
>>
>> Hi all,
>> I bring to your attention Sandy's review here:
>>
>>
https://code.launchpad.net/~camptocamp/stock-logistic-flows/6.1-add-mrp_open_lot_attributes-lep/+merge/196749
>>
>> according to pep8, two styles of indentation are possible. Take for
>> example a dictionary:
>>
>> {'name': 'spam',
>>   'color': 'brown'
>>   }
>>
>> or
>>
>> {
>>      'name': 'eggs',
>>      'color': 'white'
>> }
>>
>> According to the pep8 document and to the pep8 checker, they both work.
>> I personally would accept both.
>>
>> What do you think?
>>
>> Best, Leo
>>
>
>>
>
> I personally use the both styles accepted by the pep-008, depending on
the context.
>
> In the topic, I find weird to use the second style for the list
comprehensions as follows:
>
>     list_comprehension_of_items = [
>         item
>         for item
>         in get_all_items()
>     ]
>

Having said that, I realize that I use mostly the second for dicts and
mostly the first for lists, tuples and comprehensions.

References