# Revision history [back]

kcrisman's second approach, basically fixing the zorder after the fact, makes the most sense to me. Simply add as you like and then set the zorders from the order in the G list before printing. (I don't think G does any reshuffling, although I could be wrong about that.)

Whatever you do, don't do this.

# monkey madness
zorders = list(g.options().get('zorder') for g in args[0])
max_zorder = max(zorders) if zorders else 0
for i, p in enumerate(args[1],1):
p.set_zorder(max_zorder+i)
return f(*args)