From 854f78c80c79928cedab9dc80f11375e5c173cab Mon Sep 17 00:00:00 2001 From: hukun01 Date: Wed, 12 Feb 2014 09:23:02 -0800 Subject: [PATCH] Update tf-23-monadic.py. We can eliminate the extra parameter in the __init__. Let the naming in get_input method more clear. --- 22-passive-aggressive/tf-23-monadic.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/22-passive-aggressive/tf-23-monadic.py b/22-passive-aggressive/tf-23-monadic.py index b69e6fe..77f821d 100644 --- a/22-passive-aggressive/tf-23-monadic.py +++ b/22-passive-aggressive/tf-23-monadic.py @@ -5,10 +5,10 @@ import sys, re, operator, string # The PassiveAggressive class for this example # class TFPassiveAggressive: - def __init__(self, v): + def __init__(self): self._e = None self._offending_func = None - self._value = v + self._value = None def bind(self, func): if self._e == None: @@ -28,7 +28,7 @@ class TFPassiveAggressive: # # The functions # -def get_input(arg): +def get_input(ignore): assert(len(sys.argv) > 1), "You idiot! I need an input file! I quit!" return sys.argv[1] @@ -81,5 +81,4 @@ def top25_freqs(word_freqs): # # The main function # -TFPassiveAggressive(None).bind(get_input).bind(extract_words).bind(remove_stop_words).bind(frequencies).bind(sort).bind(top25_freqs).printme() - +TFPassiveAggressive().bind(get_input).bind(extract_words).bind(remove_stop_words).bind(frequencies).bind(sort).bind(top25_freqs).printme() \ No newline at end of file