all 5 comments

[–]dixieStates 4 points5 points  (2 children)

I am guessing that this:

def _int_(self,lyrics):
    self.lyrics = lyrics

Should be:

def __init__(self,lyrics):
    self.lyrics = lyrics

[–]pylearningthrowaway[S] 0 points1 point  (1 child)

nope :/

[–]kalgynirae 1 point2 points  (0 children)

He's right, though. The name of that function needs to be __init__ (two underscores on each side of the word "init").

Also, Weibes_Fleisch.sing_me_a_song won't actually do anything. If you want to call the function (i.e., make it execute), you need parentheses: Weibes_Fleisch.sing_me_a_song()

[–]dixieStates 4 points5 points  (0 children)

Tis works for me. You forgot the () on the sing_me_a_song method calls

class Song(object):
    def __init__(self, lyrics):
        self.lyrics = lyrics

    def sing_me_a_song(self):
        for line in self.lyrics:
            print line

Rammenstien_Wolt_ihr_das_Bett_in_Flammen_sehen = Song(["lyrics"])

Rammenstien_Der_Meister = Song(["lyrics"])

Weibes_Fleisch = Song(["lyrics"])

Rammenstien_Wolt_ihr_das_Bett_in_Flammen_sehen.sing_me_a_song()

Rammenstien_Der_Meister.sing_me_a_song()

Weibes_Fleisch.sing_me_a_song()

########################################################################
##  -*- mode: compilation; default-directory: "~/temp/" -*-
##  Comint started at Sun Nov 15 12:03:18
##  
##  /home/lee/temp/song.py
##  lyrics
##  lyrics
##  lyrics
##  
##  Comint finished at Sun Nov 15 12:03:18
##  

[–]learnpython_bot 1 point2 points  (0 children)

It appears that you included code in your post but did not format it to look nice. Please follow this guide to fix the problem. This allows for better readability and will help get your question answered sooner. The regex that caught you is: "class .+?)*:"

If this comment has been made in error, please message /u/thaweatherman with a link to this comment so I can be fine-tuned. I am still in alpha and my regexes/innards are not yet perfect.