-1

I am trying to build a Strategy Pattern using S.Lott's response.
Problem is function returns None.
Am using Hickey's Simple vs Easy {what, how, who}-logic.
-[WHAT] I/O

class base_fnc(object): def fncExc(self,data1,data2): return 

-[HOW] DATA <> queue[where,when] (direct injection)

class stump( base_fnc ): def fncExc(self, d1, aContext): return d1 class MAB(base_fnc ): def fncExc(self, d, aContext ): return d+10 

-[WHO] API

class context( object ): def __init__(self, alt_how_class ): self.how = alt_how_class def exc(self, d ): return self.how.fncExc(d, self) if __name__ == "__main__": c1 = context(MAB()) ss=c1.exc(10) print ss 

ss prints None

1
  • 1
    Downvoting because this is unlikely to be useful for others. No offense. Commented Jun 25, 2013 at 21:38

1 Answer 1

2

You're not returning in exc. You need to do return self.how.fncExc(d, self).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.