On Mon, Oct 29, 2012 at 2:28 PM, Alan Gauld <alan.ga...@btinternet.com> wrote: > On 29/10/12 08:37, Asokan Pichai wrote: > >>> teachers put stupid artificial constraints on your code, >> >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> >>> such as banning the use of len(). >> >> >> There may be legitimate learning outcomes for a teacher >> to specify such conditions. > > > In that case they should think up a scenario that requires the use of the > construct that is most appropriate. Teachers should never encourage bad > practice(*) and that's what this example does. > > It's valid to put constraints such as "do not use any external > modules" or to use a specific construct if that's what's being taught. > But it's never right to leave the student the freedom to use any solution > *except* the one that is most logical and readily available. > > >> In this case, learning to use a counter that is incremented >> under certain conditions. > > > But there are many better cases where that solution is needed rather than > using len(). This one just sounds like lazy teaching. > > (*) Actually enforcing bad practice one to demonstrate the problems > can be valid provided its followed immediately by the best practice > alternative.
As a trainer, I believe using a bad example is WRONG; even to teach how not to write. Better to critique the suggested bad answers and explain why that is bad, rather than enforce a constraint that leads to a bad way and then call it out as bad explain why. That said, it *is* preferable IMO, not use such strong condemnation without knowing full background. Probably by now this is OT, so I should stop now. Asokan Pichai If a language is designed for non-programmers, soon only non-programs get written in it. --- Anonymouse _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor