On 2018-02-17 11:23, fhsxfhsx wrote:
> [
> {
> 'id': goods.id,
> 'name': goods.name,
> 'category': gc.name,
> 'category_type': gc.type,
> }
> for goods_id in goods_id_list
> for goods is Goods.get_by_id(goods_id)
> for gc is GoodsCategory.get_by_id(goods.category_id)
> ]
I believe list comprehensions are difficult to read because they are not
formatted properly. For me, list comprehension clauses are an
expression, followed by clauses executed in the order. Any list
comprehension with more than one clause should be one-line-per clause.
Examples inline:
On 2018-02
On Fri, Feb 23, 2018 at 12:35 PM Kyle Lahnakoski
wrote:
> I believe list comprehensions are difficult to read because they are not
> formatted properly. For me, list comprehension clauses are an
> expression, followed by clauses executed in the order. Any list
> comprehension with more than one c
On Thu, Feb 22, 2018 at 6:21 PM, Nick Coghlan wrote:
> > (I wonder if the discrepancy is due to some internal interface that loses
> > the distinction between None and 1 before the decision is made whether to
> > use advanced slicing or not. But that's a possible explanation, not an
> > excuse.)
On 2018-02-23 12:44, Neil Girdhar wrote:
>
> On Fri, Feb 23, 2018 at 12:35 PM Kyle Lahnakoski
> mailto:[email protected]>> wrote:
>
>
> > [
> > (w, w**2)
> > for x in (1, 2, 3, 4)
> > let y = x+1
> > for a in range(y)
> > let z = a+1
> > i
On Fri, Feb 23, 2018 at 1:42 PM Kyle Lahnakoski
wrote:
>
>
> On 2018-02-23 12:44, Neil Girdhar wrote:
>
> On Fri, Feb 23, 2018 at 12:35 PM Kyle Lahnakoski
> wrote:
>
>>
>> > [
>> > (w, w**2)
>> > for x in (1, 2, 3, 4)
>> > let y = x+1
>> > for a in range(y)
>> > let z = a+1
>
On Sat, Feb 24, 2018 at 5:24 AM, Chris Barker wrote:
> On Thu, Feb 22, 2018 at 6:21 PM, Nick Coghlan wrote:
>>
>> > (I wonder if the discrepancy is due to some internal interface that
>> > loses
>> > the distinction between None and 1 before the decision is made whether
>> > to
>> > use advanced
23.02.18 20:50, Chris Angelico пише:
Ignoring backward compatibility, it ought to be possible to (ab)use a
stride of zero for this. Calling slice.indices() on something with a
stride of zero raises ValueError, so there's no ambiguity. But it
would break code that iterates in a simple and obvious
On Sat, Feb 24, 2018 at 6:38 AM, Serhiy Storchaka wrote:
> 23.02.18 20:50, Chris Angelico пише:
>>
>> Ignoring backward compatibility, it ought to be possible to (ab)use a
>> stride of zero for this. Calling slice.indices() on something with a
>> stride of zero raises ValueError, so there's no amb
On 24 February 2018 at 06:00, Chris Angelico wrote:
> I presume it's already too late for 3.7 to change anything to fix this.
>
Yeah, any changes in relation to this would be 3.8+ only.
To answer your previous question about "Wouldn't it be hard to fix this
given the way slice processing works?
10 matches
Mail list logo