Nine Rules for Scheduling Events

How would Slipmat’s @ scheduler work when applying various Python methodologies?

To celebrate the release of my friend Sarah MacLean’s new book, Nine Rules to Break When Romancing a Rake, here are 9 rules for scheduling events. Each of the following examples produce the exact same result:

1. Individual Events

```@0 foo()
@1 foo()
@2 foo()
@3 foo()
```

2. List

```@[0, 1, 2, 3] foo()
```

3. Identifier

```t = [0, 1, 2, 3]
@t foo()
```

4. List Comprehension

```@[i for i in range(0, 4)] foo()
```

5. Loop

```for i in range(0, 4):
@i foo()
```

6. Function

```def bar():
@0 foo()
@1 foo()
@2 foo()
@3 foo()

bar()
```

7. Nested

```foo()
1:
foo()
1:
foo()
1:
foo()
```

8. Item Iteration

```items = (0, 1, 2, 3)
@[i for i in items] foo()
```

9. Map

```def bar(x): return x
@(map(bar, range(0, 4)) foo()
```

And a special message for Sarah, “Ninjas.”

One thought on “Nine Rules for Scheduling Events”

1. Pingback: Slipmat » Lists as Micro-Sequencers