-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
chapi-ast-python/src/test/resources/call/builder_pattern_call.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## https://stackoverflow.com/questions/17321167/calling-chains-methods-with-intermediate-results | ||
|
||
class Person: | ||
def setName(self, name): | ||
self.name = name | ||
return self ## this is what makes this work | ||
|
||
def setAge(self, age): | ||
self.age = age; | ||
return self; | ||
|
||
def setSSN(self, ssn): | ||
self.ssn = ssn | ||
return self | ||
|
||
|
||
p = Person() | ||
p.setName("Hunter").setAge(24).setSSN("111-22-3333") |