You can assign attributes later; eg:.
graph.es["weight"] = range(g.ecount())
This will assign weights to all ribs at the same time. If you want to assign attributes to only a subset of edges, index or cut the sequence of edges ( g.es ), but you want:
graph.es[10:20]["weight"] = range(10)
source share