Python and Flaming Thunder

bruno.desthuilliers at gmail.com bruno.desthuilliers at gmail.com
Thu May 22 15:39:17 EDT 2008


On 22 mai, 18:56, Mensanator <mensana... at aol.com> wrote:
> On May 22, 10:30 am, Nick Craig-Wood <n... at craig-wood.com> wrote:
>
>
>
> > Dave Parker <davepar... at flamingthunder.com> wrote:
> > >  But after getting input from children and teachers, etc, it started
> > >  feeling right.
>
> > >  For example, consider the two statements:
>
> > >       x = 8
> > >       x = 10
>
> > >  The reaction from most math teachers (and kids) was "one of those is
> > >  wrong because x can't equal 2 different things at the same time".
>
> > This is a common feature in functional languages...
>
> > Eg
>
> > Erlang (BEAM) emulator version 5.6.2 [source] [smp:2]
> > [async-threads:0] [kernel-poll:false]
>
> > Eshell V5.6.2  (abort with ^G)
> > 1> X = 8.
> > 8
> > 2> X = 10.
> > ** exception error: no match of right hand side value 10
> > 3>
>
> > That error message is the erlang interpreter saying "Hey I know X is
> > 8, and you've said it is 10 - that can't be right", which is pretty
> > much what math teachers say too...
>
> Are you saying that erlang treats 1> as an assignment, yet
> treats 2> as a comparison?

Nope. Both are treated as pattern matching. The first one binds X
because it's by that time a free variable, the second fails because it
doesn't match.

> That's inconsistent.

That's consistent when you understand how Erlang works.

> No wonder nobody uses erlang.

Strange enough, it seems that more and more developpers and company
start to look at Erlang as a possible solution to massive scaling
problems.

> Why isn't erlang smart, like Python, and avoid such confusion?

Erlang *is* smart. It's just totally different from Python. And
there's no confusion here (except on your side...).




More information about the Python-list mailing list