Why Nostr? What is Njump?
2024-08-15 21:26:01
in reply to

Paul Evans on Nostr: Python doesn't have variable capture from outer scopes, or closures; thus actual ...

Python doesn't have variable capture from outer scopes, or closures; thus actual anonymous functions would be far less useful than you'd imagine.

Compare:
```perl
my @closures;
foreach my $x ( 1 .. 10 ) {
push @closures, sub { return $x };
}
```

each of the ten closures pushed to the array captures the value $x had been when it was created. Invoking each would return its own captured value. Python's one doesn't do that.
Author Public Key
npub1hlpkkqf7sthaqvhufu9v2k8p0tpy5vcv8df6zaw4jzm36s3x3g7srrgkyk