Q:

SASS Extends Dynamic

I have a SASS function I am using to calculate column width:
@for $i from 1 through $number-of-columns {
  .column-#{$i} {
     width: ($i / $number-of-columns) * 100%;
  }
}

Which works great and outputs as expected:
.column-12 {
  width: 100%;
}
.column-11 {
  width: 91.666667%;
}
.column-10 {
  width: 83.333334%;
}

But now I would like to apply a style to all of those classes like so:
column-1, column-2, column-3...column-12 {
    display: block;
}

Is there an easy way to do this using @extend?

A:

Just to illustrate how to use @extend for this. You would want to define a placeholder rule (e.g. %all-columns), that gets extended in each iteration by another class. Like so:
%all-columns {
  display: block;
}

@for $i from 1 through $number-of-columns {
  .column-#{$i} {
     width: ($i / $number-of-columns) * 100%;
     @extend %all-columns;
  }
}

DEMO
output CSS:
.column-1, .column-2, .column-3, .column-4, .column-5, .column-6, .column-7, .column-8, .column-9, .column-10, .column-11, .column-12 {
  display: block;
}

.column-1 {
  width: 8.33333%;
}

.column-2 {
  width: 16.66667%;
}

...

But if you want to avoid such a long selector, you should consider an attribute selector, like the solution suggested in Daniel's answer.

