Skip to content

Commit

Permalink
mark DepthFirstVisitor as final and add slots
Browse files Browse the repository at this point in the history
  • Loading branch information
Deric-W committed Oct 4, 2022
1 parent b69e1ff commit d587e33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lambda_calculus/visitors/walking.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from __future__ import annotations
from collections.abc import Iterator
from typing import TypeVar
from typing import TypeVar, final
from .. import terms
from . import BottomUpVisitor

Expand All @@ -15,6 +15,7 @@
V = TypeVar("V")


@final
class DepthFirstVisitor(BottomUpVisitor[Iterator["terms.Term[V]"], V]):
"""
Visitor yielding subterms depth first
Expand All @@ -24,6 +25,8 @@ class DepthFirstVisitor(BottomUpVisitor[Iterator["terms.Term[V]"], V]):
V: represents the type of variables used in terms
"""

__slots__ = ()

def visit_variable(self, variable: terms.Variable[V]) -> Iterator[terms.Term[V]]:
"""
Visit a Variable term.
Expand Down

0 comments on commit d587e33

Please sign in to comment.