Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error calling ElementaryParticle(spin).hear_me() #3

Open
ostueker opened this issue Apr 20, 2017 · 0 comments
Open

Error calling ElementaryParticle(spin).hear_me() #3

ostueker opened this issue Apr 20, 2017 · 0 comments

Comments

@ostueker
Copy link

Cell [29] in notebook ch06-classes-objects.ipynb gives an error as the (overloaded) constructor of the ElementaryParticle class doesn't create the data attributes initialized bu the generator of the Particle class.

This can be solved by calling Particle.__init__(self) explicitly:

# elementary.py
class ElementaryParticle(Particle):

    roar = "I am an Elementary Particle!"

    def __init__(self, spin):
        Particle.__init__(self)
        self.s = spin
        self.is_fermion = bool(spin % 1.0)
        self.is_boson = not self.is_fermion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant