Why pos arg should be after key arg?

Hello Everyone,

I was trying out transformation with the VCF files as shown below

mt2 = mt.select_entries(mt.GT)
mt3 = mt2.annotate_rows(n_hom_ref=hl.agg.count_where(mt2.GT.is_hom_ref()),
                        n_het = hl.agg.count_where(mt2.GT.is_het()),
                        n_hom_alt = hl.agg.count_where(mt2.GT.is_hom_var()))
mt4 = mt3.select_rows(mt3.rsid,mt3.n_het,mt3.n_hom_alt,mt3.n_hom_ref,Ref=mt3.alleles[0],Alt=mt3.alleles[1])   # this works fine.

However, if I change the last stmt like below, it throws an error.

mt3.select_rows(mt3.rsid,Ref=mt3.alleles[0],Alt=mt3.alleles[1],mt3.n_het,mt3.n_hom_alt,mt3.n_hom_ref)

q1) This is just a matrix table created out of another matrix table. like how we filter and reorder columns in pandas dataframe. But why does it have to be in the specified order?

q2) Any advice/suggestions on the code that I wrote above for getting the below-expected output? Is there any other better way to write this?

It is a rule of python that you can’t have a positional argument after a keyword argument. If you want to select mt3.n_het after Alt, you’ll have to pass in the argument as n_het=mt3.n_het.