Redian新闻
>
花了一个小时学习了python
avatar
花了一个小时学习了python# Programming - 葵花宝典
g*g
1
不错,比perl易读性强多了,用来写脚本很好。
avatar
y*e
2
你研究了Python的class,OOP吗?
avatar
g*g
3
粗浅的看了一下定义和继承。看上去跟其他语言没有太大不同。

【在 y****e 的大作中提到】
: 你研究了Python的class,OOP吗?
avatar
f*y
4
估计比perl难读的只有shell了

【在 g*****g 的大作中提到】
: 不错,比perl易读性强多了,用来写脚本很好。
avatar
i*f
5
个人觉得python各种ideas挺另类的,比如scope用缩进什么的。还有pass by
reference我也没搞清楚,好像scaler tuple什么的不能pass by reference?
可能我比较土,也没真正好好学习python,只是断断续续看了点tutorial。
我现在就是Tcl用的比较熟,我学scripting lang的过程是,try python -> try perl
-> try Tcl -> 最喜欢Tcl然后就一直用下来,呵呵

【在 g*****g 的大作中提到】
: 不错,比perl易读性强多了,用来写脚本很好。
avatar
g*g
6
这个indent是有点怪,不过在一个IDE里搞估计不是什么问题。

perl

【在 i*****f 的大作中提到】
: 个人觉得python各种ideas挺另类的,比如scope用缩进什么的。还有pass by
: reference我也没搞清楚,好像scaler tuple什么的不能pass by reference?
: 可能我比较土,也没真正好好学习python,只是断断续续看了点tutorial。
: 我现在就是Tcl用的比较熟,我学scripting lang的过程是,try python -> try perl
: -> try Tcl -> 最喜欢Tcl然后就一直用下来,呵呵

avatar
r*t
7
你看了它的crypto services 和 email module了没?可能比 JAVA 的要差,但是很有
用,一般的应用也足够了。

【在 g*****g 的大作中提到】
: 不错,比perl易读性强多了,用来写脚本很好。
avatar
c*e
8
en, its not bad. I have used it for some post log processing job when I need
it fast, yet sed/awk is not powerful enuf. one problem so far, its not very
fast in my case, however I didnt get a counter perl script to compare so ...
btw, all of u old birds stop bashing c++, no matter what drawback it has, it
is the best programming lang today in terms of usability and capability
IMHO.
avatar
t*t
9
你等着瞧, 马上goodbug就会出来的

need
very
...
it

【在 c********e 的大作中提到】
: en, its not bad. I have used it for some post log processing job when I need
: it fast, yet sed/awk is not powerful enuf. one problem so far, its not very
: fast in my case, however I didnt get a counter perl script to compare so ...
: btw, all of u old birds stop bashing c++, no matter what drawback it has, it
: is the best programming lang today in terms of usability and capability
: IMHO.

avatar
r*t
10
python code ,不管谁写的,indent 都一样,这是一个优点。
我的印象是 everything is passed by reference.

perl

【在 i*****f 的大作中提到】
: 个人觉得python各种ideas挺另类的,比如scope用缩进什么的。还有pass by
: reference我也没搞清楚,好像scaler tuple什么的不能pass by reference?
: 可能我比较土,也没真正好好学习python,只是断断续续看了点tutorial。
: 我现在就是Tcl用的比较熟,我学scripting lang的过程是,try python -> try perl
: -> try Tcl -> 最喜欢Tcl然后就一直用下来,呵呵

avatar
r*t
11
你要小心了,我认识俩10年的 JAVA 程序员,现在基本完全 switch to Python 的。

【在 g*****g 的大作中提到】
: 不错,比perl易读性强多了,用来写脚本很好。
avatar
g*g
12
haha, I tend to believe the most popular language is the
best. I am a bandwagon fan.

你等着瞧, 马上goodbug就会出来的
need
very
...
it

【在 t****t 的大作中提到】
: 你等着瞧, 马上goodbug就会出来的
:
: need
: very
: ...
: it

avatar
g*g
13
这根本不是问题,要是做python比作java赚钱多我立马就换。

【在 r****t 的大作中提到】
: 你要小心了,我认识俩10年的 JAVA 程序员,现在基本完全 switch to Python 的。
avatar
r*t
14
这倒是,没觉得那俩挣的很多 :(

【在 g*****g 的大作中提到】
: 这根本不是问题,要是做python比作java赚钱多我立马就换。
avatar
i*f
15
Yes I read about 'everything is passed by reference' in "Learn Python in 10
minutes" but it says:
"Parameters are passed by reference, but immutable types (tuples, ints,
strings, etc) cannot be changed. This is because only the memory location of
the item is passed, and binding another object to a variable discards the
old one, so immutable types are replaced."
And the function's default value issue is also wiered to me. In "Python
Tutorial":
"Important warning: The default value is evaluated on

【在 r****t 的大作中提到】
: python code ,不管谁写的,indent 都一样,这是一个优点。
: 我的印象是 everything is passed by reference.
:
: perl

avatar
r*t
16
这个挺正常,我读不出有什么奇怪的地方。这段话是解释即使是immutables are also passed by reference,然后指出其 implication。你觉得什么地方有问题?

10
of

【在 i*****f 的大作中提到】
: Yes I read about 'everything is passed by reference' in "Learn Python in 10
: minutes" but it says:
: "Parameters are passed by reference, but immutable types (tuples, ints,
: strings, etc) cannot be changed. This is because only the memory location of
: the item is passed, and binding another object to a variable discards the
: old one, so immutable types are replaced."
: And the function's default value issue is also wiered to me. In "Python
: Tutorial":
: "Important warning: The default value is evaluated on

avatar
r*t
17
你要问 why 就不好回答了,interpreter 第一次遇到 def func() 又有 default
argument 的时候不得不 evaluate default argument 吧?after that, the argument
name is bound to the default value. Because default argument is a signature
of the function, they should not be destroyed after the function returns.
Thus when you call the function again, because the function definition will
not happen again, and the default arguments is kept. The default arguments
are shared in successive calls.
第二个问题,I did not get you, what problem you w

【在 i*****f 的大作中提到】
: Yes I read about 'everything is passed by reference' in "Learn Python in 10
: minutes" but it says:
: "Parameters are passed by reference, but immutable types (tuples, ints,
: strings, etc) cannot be changed. This is because only the memory location of
: the item is passed, and binding another object to a variable discards the
: old one, so immutable types are replaced."
: And the function's default value issue is also wiered to me. In "Python
: Tutorial":
: "Important warning: The default value is evaluated on

avatar
i*f
18
Yes, "why" is not apropriate here:) Since I don't really know that much on
how scripting lang. works, that's why I feel uncomfortable with this default
arg. issue.
However, as far as I know, in Tcl, function's default arg. value behaves
quite different from what I learnt in python, and more similar to c++:
avatar
r*t
19
Ah, I see what's confusing!
What L is bound to depends on how the user calls f(): every time f() is
called, L is either bound to default object None (because user doesn't
specify L) or some object that has .append method (what's passed in). After
the function returned, L loses bound to what's passed in, thus the function
doesn't keep a reference to the data it had finished working on. different with
the previous case where the function kept a reference to the object as the
default argument, and

【在 i*****f 的大作中提到】
: Yes, "why" is not apropriate here:) Since I don't really know that much on
: how scripting lang. works, that's why I feel uncomfortable with this default
: arg. issue.
: However, as far as I know, in Tcl, function's default arg. value behaves
: quite different from what I learnt in python, and more similar to c++:

avatar
l*g
20
tcl is a nice lang. :)

perl

【在 i*****f 的大作中提到】
: 个人觉得python各种ideas挺另类的,比如scope用缩进什么的。还有pass by
: reference我也没搞清楚,好像scaler tuple什么的不能pass by reference?
: 可能我比较土,也没真正好好学习python,只是断断续续看了点tutorial。
: 我现在就是Tcl用的比较熟,我学scripting lang的过程是,try python -> try perl
: -> try Tcl -> 最喜欢Tcl然后就一直用下来,呵呵

avatar
l*g
21
anyone?

【在 l*****g 的大作中提到】
: tcl is a nice lang. :)
:
: perl

avatar
i*f
22
同意。当初最吸引我的是tcl关于everything is string, first string is command的
概念。知道这个规律加上几个variable, command substitution就够了,很简单很清晰
,对于我这样的懒人不错!呵呵!
exec也还好吧,还有open也可以用。我觉得夸张点Tcl都可以当个shell来用了(当然和
bash就各有侧重了).

list
avatar
i*f
23
Oh, thank you for the explanation! I understand what's going on here. And
also have some idea on how passing by ref. works in Python! Maybe I can
spend some time continue this tutorial.
Thanks:)

After
function
with

【在 r****t 的大作中提到】
: Ah, I see what's confusing!
: What L is bound to depends on how the user calls f(): every time f() is
: called, L is either bound to default object None (because user doesn't
: specify L) or some object that has .append method (what's passed in). After
: the function returned, L loses bound to what's passed in, thus the function
: doesn't keep a reference to the data it had finished working on. different with
: the previous case where the function kept a reference to the object as the
: default argument, and

avatar
i*f
24
yes it's nice:)

【在 l*****g 的大作中提到】
: anyone?
avatar
m*t
25

I am very ruby these days. 8-)

【在 r****t 的大作中提到】
: 你要小心了,我认识俩10年的 JAVA 程序员,现在基本完全 switch to Python 的。
avatar
g*g
26
What are you using ruby for? pure ruby or jruby?

【在 m******t 的大作中提到】
:
: I am very ruby these days. 8-)

avatar
i*f
27
awk 不是很熟。我有做一个简单的call gnuplot画图的脚本。就是用open pipe到
gnuplot写gnuplot的命令,应该也可以读,感觉还行。
avatar
m*t
28

I just needed a scripting language in my toolbox for,
well, scripting things.
I could do most things in bash, but the logical test
operations in bash are just horrific.
Perl was ruled out because I would like to
be able to actually understand what I wrote after
a while.
Python I tried as well, but disliked the strong C
flavor, and the "indentations matter" philosophy.
So ruby turned out to be quite flexible, with a strong
OO style. _And_ the potential to integrate with java via
jruby. That's a

【在 g*****g 的大作中提到】
: What are you using ruby for? pure ruby or jruby?
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。