[Edu-sig] Types and true division (was Re: strange output)
Michael Williams
michael.williams@st-annes.oxford.ac.uk
Mon, 7 Oct 2002 11:04:44 +0100 (BST)
In message <004601c26bfc$dcf1cd00$9865fea9@arthur> "Arthur" <ajs@ix.netcom.com> writes:
> >The course is a *programming* course (not a physics course, although it is
> for
> >physics undergrads). You can read the handbook and my dissertaion
> discussing
> >Python's relative merits here:
>
> I read excerpts of the handbook and dissertation - both of which are
> interesting.
>
> But I don't agree with your take on "/". Or necessarily disagree. 1/2=.5
> *is* more intutive to someone who has not programmed before. Common sense
> would allow us to conclude that is true in the absence of any study of the
> issue. Just as I think common sense allows us to conclude that list[1] is
> more intutively the first item in the list, rather than the second.
Indeed.
> You toss off the issue of numeric typing is a few sentences of the handbook,
> and it comes into play in the creation of Numeric arrays.
Correct.
> The problem is that I don't think you will know to what extent your students
> actually grasp the significance of the numeric typing issue. One can get
> far enough without understanding it. It only becomes an issue when it
> becomes an issue.
The whole reason we're using Python is that we can get away without explaining
everything the first time around, and come back to stuff like this in a
second year course. Numeric typing is important, yes, but when you've got two
days to teach students programming, you've got to be selective.
> For example perhaps while doing a
>
> a[1] = .5
>
> to an array that was initially as an int array, not so much consciously as
> by a=array([1,2,3}).
>
> Not something that one does everyday.
This actually came up in onse student's program -- so you are correct that it
is a real problem.
> The interesting study might be to see if your students acutally *get* the
> significance and pitfalls of the underlying numeric typing system.
I would imagine not. ;-)
> Seems to me that for a physics student, it is particularly important that
> they do. For example, to be aware of the pitfalls that can arise in
> comparing values for equality.
As I say above, unfortunately we have to be *very* selective. It was decided
it was worth spending more time on procedural concepts like control flow, and
some time on graphing, simply because those two very quickly give an immediate
and tangible return on a student's investment of their time.
We have a real problem with student retention; programming becomes an elective
in the second year. I agree with you entirely that typing and the internal
representation system of a computer is *crucial* to a physicist's understanding.
Whether it's the *most crucial* is another matter ;->
> So I still ask whether it is necessarily true that the more intutive
> behavior is the behavior we should prefer in all cases. It is perhaps
> unintuitive to suggest not. But I am suggesting it.
This argument was pretty much done to death around the time of the PEP on
comp.lang.python.
By the way, the versions of both my handbook and dissertation on
<http://users.ox.ac.uk/~sann1276/> are not final versions. In particular, our
first batch of "real" first years (not trial volunteers) arrive next week, and
we're putting a lot of finishing touches to it.
For example, after you reminded me of the problem with truncation of floats
when stored in arrays of ints I added a little bit on this. Thanks for your
comments. I'll be posting to this list and other relevant ones when there is
something a bit more final to look at (which had better be within the next
few days, otherwise I'm in trouble!)
Cheers,
--
Michael