`
sillycat
  • 浏览: 2486655 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

English-010 DiveIntoPython

阅读更多
English-010 DiveIntoPython

1.This chapter covers one of Python's strengths: introspection.
introspection [,intrəu'spekʃən]  n. 内省;反思;自省

2.Don't worry if the rest of the code looks intimidating; you'll learn all about it throughout this chapter.
intimidating   adj. 吓人的

3.The info function has a multi-line doc string that succinctly describes the function's purpose. Note that no return value is mentioned; this function will be used solely for its effects, rather than its value.
succinct [sək'siŋkt, sə's-]  adj. 简洁的;简明的;紧身的
solely ['səulli]  adv. 单独地,唯一地

4.By default the output is formatted to be easy to read. Multi-line doc strings are collapsed into a single long line, but this option can be changed by specifying 0 for the collapse argument. If the function names are longer than 10 characters, you can specify a larger value for the spacing argument to make the output easier to read.
collapse [kə'læps]  vi. 倒塌;瓦解;暴跌

5.This looks totally whacked until you realize that arguments are simply a dictionary.
whacked [hwækt] adj. 疲惫不堪的,精疲力竭的

6.Python has a small set of extremely useful built-in functions. All other functions are partitioned off into modules. This was actually a conscious design decision, to keep the core language from getting bloated like other scripting languages
partitioned  adj. 分区的;分割的;分段的  partition off   分隔成;隔开
partition [pɑ:'tiʃən] n. 分割;划分,分开;隔离物;隔墙  vt. 分割;区分;分隔
conscious ['kɔnʃəs] adj. 意识到的;故意的;神志清醒的
bloated ['bləutid]  adj. 傲慢的;发胀的,浮肿的

7.The str coerces data into a string. Every datatype can be coerced into a string.
coerce [kəu'ə:s]  vt. 强制,迫使   coerce into: 强迫...做

8.The functions in the string module are deprecated (although many people still use the join function), but the module contains a lot of useful constants like this string.punctuation, which contains all the standard punctuation characters.
punctuation [,pʌŋktju'eiʃən]  n. 标点;标点符号

9.Python comes with excellent reference manuals, which you should peruse thoroughly to learn all the modules Python has to offer. But unlike most languages, where you would find yourself referring back to the manuals or man pages to remind yourself how to use these modules, Python is largely self-documenting.
peruse [pə'ru:z]  vt. 详细考察;精读

10.In case it hasn't sunk in just how incredibly useful this is, try this: the return value of getattr is the method, which you can then call just as if you had said li.append("Moe") directly. But you didn't call the function directly; you specified the function name as a string instead.
sunk [sʌŋk]  adj. 凹陷的  sink in 渗入;完全被理解
incredibly  adv. 难以置信地;非常地  incredible [in'kredəbl]  adj. 难以置信的,惊人的

11.A common usage pattern of getattr is as a dispatcher. For example, if you had a program that could output data in a variety of different formats, you could define separate functions for each output format and use a single dispatch function to call the right one.
dispatcher [dis'pætʃə]  n. 调度员;调度程序;分配器
variety [və'raiəti]  n. 种类;多样;杂耍

12.This is a very loose coupling of strings and functions, and there is no error checking. What happens if the user passes in a format that doesn't have a corresponding function defined in statsout?
loose [lu:s]   adj. 不牢固的;不精确的;宽松的;散漫的
coupling ['kʌpliŋ]   n. 耦合;结合,联结
corresponding [,kɔ:ri'spɔndiŋ]   adj. 通信的;一致的;相当的,相应的

13.As you know, Python has powerful capabilities for mapping lists into other lists, via list comprehensions (Section 3.6, “Mapping Lists”). This can be combined with a filtering mechanism, where some elements in the list are mapped while others are skipped entirely.
capability [,keipə'biləti]  n. 性能,容量;才能,能力
mechanism ['mekənizəm]  n. 机械装置;机制;技巧;原理,途径;进程
entire [in'taiə]  adj. 全部的,整个的;全体的

14.The mapping expression here is simple (it just returns the value of each element), so concentrate on the filter expression.
concentrate ['kɔnsəntreit]  vi. 集中;浓缩;聚集;全神贯注

15.The filter expression looks scary, but it's not. You already know about callable, getattr, and in.
scary ['skεəri, 'skæ-] adj. 引起惊慌的;胆小的;提心吊胆的

16.You do the weeding out by taking the name of each attribute/method/function and getting a reference to the real thing, via the getattr function.
weed [wi:d]  vt. 除草;铲除

17.peculiar [pi'kju:ljə]  adj. 特殊的;罕见的;奇怪的;独特的

18.This distinction is important if some values can have side effects.
distinction [dis'tiŋkʃən]  n. 差别;区别;特性;荣誉、勋章

19.Python supports an interesting syntax that lets you define one-line mini-functions on the fly.
on the fly  在飞行中;忙忙碌碌 联机;在飞行中, 不工作, 闲混;在飞行中;真时
Programming on the fly: 程序人生

20.This is a lambda function that accomplishes the same thing as the normal function above it. Note the abbreviated syntax here: there are no parentheses around the argument list, and the return keyword is missing (it is implied, since the entire function can only be one expression). Also, the function has no name, but it can be called through the variable it is assigned to.
accomplish [ə'kʌmpliʃ, ə'kɔm-] vt. 完成;实现;达到
abbreviated [ə'bri:vi,eitid]  adj. 小型的;简短的;服装超短的
implied [im'plaid] v. 意思是(包含) a. 储蓄的 adj. 含蓄的;暗指的

21.To generalize, a lambda function is a function that takes any number of arguments (including optional arguments) and returns the value of a single expression.

22.All the dominoes are in place; it's time to knock them down.
domino ['dɔminəu] n. 多米诺骨牌;面具;化装外衣

23.The next piece of the puzzle is the use of str around the doc string.

24.ljust pads the string with spaces to the given length.
pad [[pæd]]  vt. 填补;走

25.If the given length is smaller than the length of the string, ljust will simply return the string unchanged. It never truncates the string.
truncate ['trʌŋkeit, trʌŋ'keit, 'trʌŋk-] vt. 把…截短;缩短;[物]使成平面
分享到:
评论

相关推荐

    Dive into python (英文)

    Dive into python, English version

    Test-Driven Development with Python [2017]

    Dive into the TDD workflow, including the unit test/code cycle and refactoring Use unit tests for classes and functions, and functional tests for user interactions within the browser Learn when and ...

    MQTT Essentials - A Lightweight IoT Protocol

    Dive deep into one of IoT's extremely lightweight machines to enable connectivity protocol with some real-world examples Learn to take advantage of the features included in MQTT for IoT and Machine-to...

    Large Scale Machine Learning with Python

    Dive into scalable machine learning and the three forms of scalability. Speed up algorithms that can be used on a desktop computer with tips on parallelization and memory allocation. Get to grips with...

    Python Data Analysis Cookbook

    In this book, you will dive deeper into recipes on spectral analysis, smoothing, and bootstrapping methods. Moving on, you will learn to rank stocks and check market efficiency, then work with metrics...

    Python Deep Learning

    Whether you want to dive deeper into Deep Learning, or want to investigate how to get more out of this powerful technology, you’ll find everything inside. What you will learn Get a practical deep ...

    LargeScaleMachineLearningwithPython.pdf

    Large Scale Machine Learning with Python [PDF + EPUB + CODE] Packt Publishing | August 4, 2016 | English | 439 pages Large Python machine learning projects involve new problems associated with ...

    Hands-On Machine Learning with Scikit-Learn and TensorFlow [EPUB]

    decision trees, random forests, and ensemble methods Use the TensorFlow library to build and train neural nets Dive into neural net architectures, including convolutional nets, recurrent nets, and ...

    Hands-On Machine Learning with Scikit-Learn and TensorFlow [Kindle Edition]

    Dive into neural net architectures, including convolutional nets, recurrent nets, and deep reinforcement learning Learn techniques for training and scaling deep neural nets Apply practical code ...

    Machine.Learning.in.Python

    The chapters on penalized linear regression and ensemble methods dive deep into each of the algorithms, and you can use the sample code in the book to develop your own data analysis solutions. ...

    Machine Learning in Python 无水印pdf 0分

    The chapters on penalized linear regression and ensemble methods dive deep into each of the algorithms, and you can use the sample code in the book to develop your own data analysis solutions....

    Python Machine Learning By Example [2017].azw3电子书下载

    Dive deep into the world of analytics to predict situations correctly Implement machine learning classification and regression algorithms from scratch in Python Be amazed to see the algorithms in ...

    Advanced Analytics with Spark: Patterns for Learning from Data at Scale

    You’ll start with an introduction to Spark and its ecosystem, and then dive into patterns that apply common techniques—including classification, clustering, collaborative filtering, and anomaly ...

    Building Recommendation Engines

    Dive into the various techniques of recommender systems such as collaborative, content-based, and cross-recommendations Create efficient decision-making systems that will ease your work Familiarize ...

    Raspberry Pi Zero Cookbook

    Deep dive into the components of the small yet powerful Raspberry Pi Zero Get into grips with integrating various hardware, programming, and networking concepts with the so-called “cheapest computer...

    Packt.Django.Project.Blueprints.2016

    Dive deep into Django forms and how they work internally About the Author Asad Jibran Ahmed is an experienced programmer who has worked mostly with Django-based web applications for the past 5 years. ...

    React and React Native [Kindle Edition]

    Dive deep into each platform, from routing in React to creating native mobile applications that can run offline Use Facebook's Relay, React and GraphQL technologies, to create a unified architecture ...

Global site tag (gtag.js) - Google Analytics