Skip to content

Instantly share code, notes, and snippets.

@UNIcodeX
Created August 13, 2020 16:52
Show Gist options
  • Save UNIcodeX/a63a0417dcc2a7dd6f13e26184f7268d to your computer and use it in GitHub Desktop.
Save UNIcodeX/a63a0417dcc2a7dd6f13e26184f7268d to your computer and use it in GitHub Desktop.

Revisions

  1. UNIcodeX created this gist Aug 13, 2020.
    18 changes: 18 additions & 0 deletions stacklessGlobalMutate.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    import stackless

    class T:
    metric = 0

    instance_T = T


    def increment_T_metric(instance):
    instance.metric += 1


    for i in range(0, 500):
    stackless.tasklet(increment_T_metric)(instance_T)

    stackless.run()

    print(instance_T.metric)