[Edu-sig] Setting a variable's value
Andre Roberge
andre.roberge at gmail.com
Thu May 11 15:57:17 CEST 2006
On 5/11/06, Winston Wolff <winstonw at stratolab.com> wrote:
> I'm considering a proposal for Python 3000 and want to get some other
> opinions. I propose adding an alternative syntax for assigning a
> value to a variable so that the Python statement:
> a = 1
> could also be written:
> a := 1
> The reason is to help students who are familiar with the Algebraic
> meaning of "a = 1" (a is always equal to one) and get confused when
> the Python meaning of "a = 1" (put the value of one into the variable
> a).
>
> I teach middle and high-school students who are learning Algebra at
> the same time as Python, and it is very confusing to them when the
> same symbols mean two subtly different things. I would propose that
> the second syntax (a := 1), be available so that I could introduce
> that in the first semester course. Later, once they understood the
> meaning of "a := 1", they could switch the shorter syntax "a = 1".
>
> Any opinions?
>
Since you ask!...
I do not like it. In Python you can do things like
a += 1
a -= 1
a *= 1
a /= 1 # :-)
Many students will be familiar with ":" meaning division or ratio. In
the context above,
what would you think
a := 1
should mean? Sooner or later, students have to learn that equality is
(tested with) "==" in Python, not with "=".
"There should be one-- and preferably only one --obvious way to do it."
I don't believe in adding special notation specifically designed for
beginner's sake - even though I am dedicated in making Python as easy
to learn as possible.
André
> -Winston
>
>
>
> ______________________________________________________
> winston wolff - (646) 827-2242 - http://www.stratolab.com
> learning by creating - video game courses for kids in new york
>
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
More information about the Edu-sig
mailing list