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.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor