Skip to content

Commit 0f415b4

Browse files
authored
Update 1-objects-and-references.md
There is a syntax error in the comparison at the end of the line, caused by the colon
1 parent 0cb4ce4 commit 0f415b4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

data/part-9/1-objects-and-references.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ class Person:
934934
# NB: type hints must be enclosed in quotation marks if the parameter
935935
# is of the same type as the class itself!
936936
def older_than(self, another: "Person"):
937-
return self.year_of_birth < another.year_of_birth:
937+
return self.year_of_birth < another.year_of_birth
938938
```
939939

940940
As stated in the comments in the examples above, if the parameter in a method definition is of the same type as the class itself, the type hint must be enclosed in quotation marks. Leaving the quotation marks out causes an error, which you will see if you try the following:

0 commit comments

Comments
 (0)