osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)


On Sun, Jul 01, 2018 at 08:35:08AM -0700, Michael Selik wrote:
> On Sun, Jul 1, 2018 at 12:39 AM Tim Peters <tim.peters at gmail.com> wrote:
> 
> > So, ya, when someone claims [assignment expressions will] make Python
> > significantly harder to teach, I'm skeptical of that claim.
> >
> 
> I don't believe anyone is making that claim. My worry is that assignment
> expressions will add about 15 to 20 minutes to my class and a slight
> discomfort.

How do people who teach other languages deal with this?

Assignment expressions are hardly a new-fangled innovation of Python's. 
They're used in Java, Javascript, Ruby, Julia, R, PHP and of course 
pretty much the entire C family (C, C++, C# at least). What do 
teachers of those languages do?

R has a similar demographic of users (strong in the sciences, many 
beginners to programming, growing in popularity). Once R teachers have 
taught that you can assign values like this:

    x = 1 + 2

does it take them 15-20 minutes to teach that you can do this as well?

   y = (x = 1 + 2) + 3

Admittedly R has the advantage that they don't have to teach a distinct 
assignment syntax and explain *why* it ought to be distinct. But 
countering that, they have *four* different ways of doing assignment.

    x <- expression
    expression -> x
    x = expression
    assign('x', expression)

(all of which can be used as expressions).


> As Mark and Chris said (quoting Mark below), this is just one straw in the
> struggle against piling too many things on the haystack. Unlike some
> changes to the language, this change of such general use that it won't be
> an optional topic. Once widely used, it ain't optional.

Without knowing the details of your course, and who they are aimed at, 
we cannot possibly judge this comment. Decorators are widely used, but 
surely you don't teach them in a one day introductory class aimed at 
beginners?

Here is the syllabus for a ten week course:

https://canvas.uw.edu/courses/1026775/pages/python-100-course-syllabus

Note that decorators and even regular expressions don't get touched 
until week ten. If you can't fit assignment expressions in a ten week 
course, you're doing something wrong. If you can't fit them in a two 
hour beginners course, there is so much more that you aren't covering 
that nobody will notice the lack.


-- 
Steve