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

DL Neil PyTutor at danceswithmice.info
Tue Feb 11 17:24:48 EST 2020


On 12/02/20 11:10 AM, David Rock wrote:
> 
>> 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.

Training is largely idealistic - at least its educational component.

If you've just completed a learning session entitled or involving "if", 
doesn't it follow that the session's assignment will involve same?


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

The intent was not to debate the OP's constraints - out of his/her 
control; but to ask if such 'advice' is actually helpful, because of the 
very nature of writing code.


NB some posts/suggested-solutions did not include 'if', which raises the 
question: if a trainee does not use 'if', is that a bad thing (wrt to 
the objectives of that learning-session), or is it a great thing ((s)he 
has figured-out a perfectly valid solution to the problem)?
-- 
Regards =dn


More information about the Tutor mailing list