Skip to content

Commit 82da1c3

Browse files
authored
update doc-string of Agent class (#1187)
make it clear that the word slot refers to instance attribute, so it won't be confused with __slots__ magic.
1 parent 746477a commit 82da1c3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

agents.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ def display(self, canvas, x, y, width, height):
6767

6868

6969
class Agent(Thing):
70-
"""An Agent is a subclass of Thing with one required slot,
71-
.program, which should hold a function that takes one argument, the
72-
percept, and returns an action. (What counts as a percept or action
70+
"""An Agent is a subclass of Thing with one required instance attribute
71+
(aka slot), .program, which should hold a function that takes one argument,
72+
the percept, and returns an action. (What counts as a percept or action
7373
will depend on the specific environment in which the agent exists.)
74-
Note that 'program' is a slot, not a method. If it were a method,
75-
then the program could 'cheat' and look at aspects of the agent.
76-
It's not supposed to do that: the program can only look at the
77-
percepts. An agent program that needs a model of the world (and of
78-
the agent itself) will have to build and maintain its own model.
79-
There is an optional slot, .performance, which is a number giving
80-
the performance measure of the agent in its environment."""
74+
Note that 'program' is a slot, not a method. If it were a method, then the
75+
program could 'cheat' and look at aspects of the agent. It's not supposed
76+
to do that: the program can only look at the percepts. An agent program
77+
that needs a model of the world (and of the agent itself) will have to
78+
build and maintain its own model. There is an optional slot, .performance,
79+
which is a number giving the performance measure of the agent in its
80+
environment."""
8181

8282
def __init__(self, program=None):
8383
self.alive = True

0 commit comments

Comments
 (0)