Python - Function Generator expressions

Introduction

The generator expressions are comprehensions in parentheses instead of square brackets.

They yield their values automatically, expressions can often be more concise in specific use cases like this:

Demo

S = 'test'
G = (S[i:] + S[:i] for i in range(len(S)))   # Generator expression equivalent 
list(G)

Related Topic