Created
October 11, 2010 20:59
Revisions
-
fohlin revised this gist
Mar 30, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ def say(s): subprocess.call(['say', str(s)]) class SpeakingList(list): """This custom list speaks (if you're on OS X). Amazing!""" def __init__(self): super(SpeakingList, self).__init__() say("A new list is born!") -
fohlin revised this gist
Oct 11, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ def say(s): class SpeakingList(list): """This custom lists speaks (if you're on OS X). Amazing!""" def __init__(self): super(SpeakingList, self).__init__() say("A new list is born!") def append(self, value): -
fohlin created this gist
Oct 11, 2010 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ # Using the OS X "say" command to demo inheritance # Thanks to Simon Willison for inspiration: http://gist.github.com/267147 import subprocess def say(s): subprocess.call(['say', str(s)]) class SpeakingList(list): """This custom lists speaks (if you're on OS X). Amazing!""" def __init__(self): super(SpeakingList, self).__init__(self) say("A new list is born!") def append(self, value): super(SpeakingList, self).append(value) say("Added: %s" % value) def __len__(self): l = super(SpeakingList, self).__len__() say("The list length is %s" % l) return l