[Tutor] Searching a list for a value, was Re: (no subject)

David Rock david at graniteweb.com
Tue Feb 11 17:10:55 EST 2020


> On Feb 11, 2020, at 15:45, David L Neil via Tutor <tutor at python.org> wrote:
> 
> These days, and not necessarily in-agreement with colleagues, I'm inclined against offering specific "use an if" advice - in the same way that when starting to develop a system one is wise not to impose artificial limits or pre-judge 'the best' solution (as in "must involved 'xyz' package/system/hardware/latest-shiny-object”)!

While that’s a nice idealistic viewpoint, it doesn’t change the fact you have to start somewhere.  Starting with “use an if” is no better/worse than any other option when you have to produce something.  The very nature of writing code implies pre-judgement; you _must_ pick something, or nothing gets written.  

In the case of the OP, "using an if" was part of the requirements, for better or worse; hence the "suggestions.”

— 
David Rock
david at graniteweb.com






More information about the Tutor mailing list