From 6fe11aa205c548d76967ab0c4030e26baebc3777 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Fri, 24 Apr 2020 10:32:48 -0700 Subject: [PATCH] Remove `__next__`. --- joy/library.py | 4 ++-- joy/utils/compiler.py | 4 ++-- joy/utils/infinite_stack.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/joy/library.py b/joy/library.py index c8d2c74..5362efa 100644 --- a/joy/library.py +++ b/joy/library.py @@ -75,8 +75,8 @@ from .utils.types import ( ) -_SYM_NUMS = lambda: next(count()) -_COMB_NUMS = lambda: next(count()) +_SYM_NUMS = lambda c=count(): next(c) +_COMB_NUMS = lambda c=count(): next(c) _R = list(range(10)) diff --git a/joy/utils/compiler.py b/joy/utils/compiler.py index e74b40f..d152743 100644 --- a/joy/utils/compiler.py +++ b/joy/utils/compiler.py @@ -36,8 +36,8 @@ class InfiniteStack(tuple): _NAMES = _names() next(_NAMES) - names = _NAMES.__next__ - reset = lambda _, _n=_NAMES: _n.send(-1) + names = lambda: next(_NAMES) + reset = lambda _self, _n=_NAMES: _n.send(-1) def __init__(self, code): self.reset() diff --git a/joy/utils/infinite_stack.py b/joy/utils/infinite_stack.py index f373835..979be90 100644 --- a/joy/utils/infinite_stack.py +++ b/joy/utils/infinite_stack.py @@ -11,7 +11,7 @@ def _names(): class InfiniteStack(tuple): - names = _names().__next__ + names = lambda n=_names(): next(n) def __iter__(self): if not self: