first python differ erlang

erlang

shankyan@early:~$ erl
Erlang/OTP 17 [erts-6.0] [source] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V6.0  (abort with ^G)
1> a = 1.
** exception error: no match of right hand side value 1
2> A = 1.
1
3> A = 2.
** exception error: no match of right hand side value 2
4> A .
1
5> 

python

shankyan@early:~$ python
Python 2.7.3 (default, Dec 18 2014, 19:03:52) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 1;
>>> a;
1
>>> a = 2;
>>> a;
2
>>> 

python中的 字典有点儿类似于erlang 中的 maps,但是定义不一样,一:变量 breakerlang中是常数的,二:重新赋值

>>> menus = {};
>>> menus[break] = "break";
  File "", line 1
    menus[break] = "break";
              ^
SyntaxError: invalid syntax
>>> menus["break"] = "break";
>>> menus["lunch"] = "lunch";
>>> menus;
{'break': 'break', 'lunch': 'lunch'}
>>> menus = {"A" : "a", "B":"b"};
>>> menus;
{'A': 'a', 'B': 'b'}
>>> 

首次尝试到编译器和文档中文件交互

原文地址:https://www.cnblogs.com/ShankYan/p/4225033.html