Today i finish Learning Python, I think next step is Programming Python or Python manual, Python's success mostly is attributed to it's smart core and Introspection .
What is introspection ?
Everything is object, manipulate in unique way, Python know what it is, using a few set of build-in functions , such as type, str , dir , getattr.
By keeping a tiny core, enclose everything else into module, leading Python a very healthy language, unlike the big , complex beast language (eg, Perl)
Why smart ?
- for loop is so smart , look this code ,
methodList = [method for method in dir(object) if callable(getattr(object, method))]
#a list generator
- and or , and or is very useful condition judgment, like a Bash syntax .
- 3 mainly data structure was selected, covered most of area of a language should be .
没有评论:
发表评论