Skip to content

Commit

Permalink
Solution for: Issue - Segfault extending by inheritance in python #165
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmerten committed Jan 30, 2018
1 parent d5c4e6e commit 141c2ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Extending-CRPropa.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ class MySourceFeature(SourceFeature):
def prepareCandidate(self, candidate):
candidate.setRedshift(0.6)

# The source feature has to be created outside of the class attribute
# s.add(MySourceFeature()) wil NOT work!
srcFtr = MySourceFeature()
s = Source()
s.add(MySourceFeature())
s.add(srcFtr)
c = s.getCandidate()
print c.getRedshift()
```
Expand Down

0 comments on commit 141c2ca

Please sign in to comment.