Much of QIIME is difficult to read and that is terrible.

Looking at other large python projects, you almost never see them. There
are only 2 in IPython, for instance, and they are not easy to read:

```bash
$ find . -name "*.py" -exec grep -H "\[.* for .* for .*\]" {} \;
./utils/data.py:    return [x for subseq in seq for x in subseq]
./utils/text.py:    return ([[ _get_or_default(items, c*nrow+i,
default=empty) for c in range(ncol) ] for i in range(nrow) ], info)
```

In the case of the data.py one, this is done for a performance benefit on a
highly used method. In that case, it makes sense to sacrifice readability
for performance gains as is often the trade-off. In numpy, you see 10 or
so, but they are in test code and they are also very difficult to read. I
encourage you to go to your site-packages directory and run the above find
statement. There are small situations where these _may_ make sense for
performance reasons, but I disagree they offer a readability improvement.


On Wed, Dec 4, 2013 at 11:04 AM, Will Van Treuren
<notifications@github.com>wrote:

> In qiime/otu_significance.py:
>
> > +    taxonomy_md = biom_taxonomy_formatter(bt, md_key)
> > +    if taxonomy_md is not None:
> > +        for i in range(num_lines):
> > +            lines[i+1]=lines[i+1]+'\t'+taxonomy_md[i] #skip header line in lines
> > +    return lines
> > +
> > +# Functions for gradient correlation testing
> > +
> > +def grouped_correlation_row_generator(bt, pmf, category, gc_to_samples):
> > +    '''Create generator for grouped correlation tests.
> > +
> > +    '''
> > +    data = array([bt.observationData(i) for i in bt.ObservationIds])
> > +    category_values = gc_to_samples.keys()
> > +    samples = gc_to_samples.values()
> > +    sample_inds = [[bt.getSampleIndex(i) for i in group] for group in samples]
>
> Could it be that you all are just not used to reading them? I find a lot
> of code tremendously unreadable but I have to get used to it because I am
> part of a team. For instance, things that are on multiple lines (i.e. for
> loops) are far less comprehensible to me than things on a single line. Now,
> if your argument is "we do a lot more code than you do @wdwvt1<https://github.com/wdwvt1>,
> so our opinions are more important on this question" thats fine. Be
> explicit about that and I will back down. I think that we are excluding a
> valuable tool because of a risk that is solvable, e.g. you tell me that
> line XYZ is inscrutable and I change it. In the future I will try to make
> less, and more precise use of this tool. The python docs<
> http://docs.python.org/2/tutorial/datastructures.html#list-comprehensions>
> show some neat usage examples and I think I have also isolated some good
> ones. The ones you pointed out as bad I am changing.
> … <#142bec8f309ed6eb_>
> On Wed, Dec 4, 2013 at 10:59 AM, Daniel McDonald <notifications@github.com>wrote:
> In qiime/otu_significance.py: > + taxonomy_md = biom_taxonomy_formatter(bt,
> md_key) > + if taxonomy_md is not None: > + for i in range(num_lines): > +
> lines[i+1]=lines[i+1]+'\t'+taxonomy_md[i] #skip header line in lines > +
> return lines > + > +# Functions for gradient correlation testing > + > +def
> grouped_correlation_row_generator(bt, pmf, category, gc_to_samples): > +
> '''Create generator for grouped correlation tests. > + > + ''' > + data =
> array([bt.observationData(i) for i in bt.ObservationIds]) > +
> category_values = gc_to_samples.keys() > + samples = gc_to_samples.values()
> > + sample_inds = [[bt.getSampleIndex(i) for i in group] for group in
> samples] It is very easy for nested list comprehensions to become
> unreadable. Allowing them at all will make it easier for nasty ones slip
> through. Disallowing them is an explicit point that I will like to see
> included in the to-be-refreshed guidelines. It is much more important to
> err on the side of readability; code maintenance is hard enough as is. …
> <#142bec360df609a2_> On Wed, Dec 4, 2013 at 10:57 AM, Yoshiki Vázquez Baeza
> < notifications@github.com> wrote: In qiime/otu_significance.py: > +
> taxonomy_md = biom_taxonomy_formatter(bt, md_key) > + if taxonomy_md is not
> None: > + for i in range(num_lines): > +
> lines[i+1]=lines[i+1]+'\t'+taxonomy_md[i] #skip header line in lines > +
> return lines > + > +# Functions for gradient correlation testing > + > +def
> grouped_correlation_row_generator(bt, pmf, category, gc_to_samples): > +
> '''Create generator for grouped correlation tests. > + > + ''' > + data =
> array([bt.observationData(i) for i in bt.ObservationIds]) > +
> category_values = gc_to_samples.keys() > + samples = gc_to_samples.values()
> > + sample_inds = [[bt.getSampleIndex(i) for i in group] for group in
> samples] This is one of those things where IMHO you either allow them all
> or not. You cannot only allow "the ones that are clear" because then this
> becomes very ambiguous very quickly. Given that we don't have coding
> guidelines and that disallow this as it is, it seems hard to just say no to
> this particular line. — Reply to this email directly or view it on GitHub<
> https://github.com/qiime/qiime/pull/1091/files#r8103445> . — Reply to
> this email directly or view it on GitHub<
> https://github.com/qiime/qiime/pull/1091/files#r8103497> .
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/qiime/qiime/pull/1091/files#r8103689>
> .
>