bartc wrote: > > "Steve Holden" <st...@holdenweb.com> wrote in message > news:mailman.1998.1265399766.28905.python-l...@python.org... >> Arnaud Delobelle wrote: >>> Robert Kern <robert.k...@gmail.com> writes: >>> >>>> I prefer Guido's formulation (which, naturally, I can't find a direct >>>> quote for right now): if you expect that a boolean argument is only >>>> going to take *literal* True or False, then it should be split into >>>> two functions. >>> >>> So rather than three boolean arguments, would you have eight functions? >>> >> If there's genuinely a need for that functionality, yes. > > So you want a function such as drawtext(s, bold=true, italic=false, > underline=true) to be split into: > > drawtext(s) > drawtextb(s) > drawtexti(s) > drawtextu(s) > drawtextbi(s) > drawtextbu(s) > drawtextiu(s) > drawtextbiu(s) > The case I was discussing was where the function was required to implement significantly different logic flow for the two different values of the Boolean.
> Which of course is going to be fun if the bold/italic/underline values > are not constants; instead of writing: > > drawtext(s,b,i,u) > > you have to say: > > if b==0 and i==0 and u==0: > drawtext(s) > elif b==1 and i==0 and u==0: > drawtextb(s) > > and so on. With half-a-dozen or more booleans, this becomes completely > impractical. > It's completely impractical the way you've written it anyway, since the drawtext function shouldn't be required to know whether it's printing bold, italic, etc. - those properties should be attributes of the font. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/ Holden Web LLC http://www.holdenweb.com/ UPCOMING EVENTS: http://holdenweb.eventbrite.com/ -- http://mail.python.org/mailman/listinfo/python-list