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. 把…截短;缩短;[物]使成平面
资源下载链接为: https://pan.quark.cn/s/0c983733fad2 本文主要回顾了2021年之前及2021年中国科学技术大学软件学院(简称“中科大软院”)高级软件工程(MN)专业的考试情况,重点聚焦于编程题。编程题在考试中的占比不断提高,因此考生需要深入理解这些题目及其解题方法。 中科大软院的高级软件工程专业致力于培养具备深厚理论基础和强大实践能力的高级软件人才。课程设计注重理论与实践相结合,以满足软件行业对高素质工程师的需求。考试内容通常涵盖计算机基础知识、软件工程理论、编程语言、数据结构与算法、操作系统、数据库系统等多个领域。2021年的考试中,编程题的比重进一步提升,这体现了学院对学生实际编程能力和问题解决能力的重视。 编程题通常涉及常见的编程问题,例如字符串处理、数组操作、递归算法、图论问题等,也可能包括网络编程、数据库查询或系统设计等特定领域的应用。考生需要熟练掌握至少一种编程语言,如C++、Java、Python等,并具备较强的算法分析和实现能力。在解题过程中,考生需要注意以下几点:一是准确理解题目要求,避免因误解而导致错误;二是合理选择并设计算法,考虑时间复杂度和空间复杂度,追求高效性;三是遵循良好的编程规范,注重代码的可读性和可维护性;四是考虑边界条件和异常情况,编写健壮的代码;五是编写测试用例,对代码进行充分测试,及时发现并修复问题。 对于备考的同学,建议多做历年试题,尤其是编程题,以熟悉题型和解题思路。同时,可以参加编程竞赛或在在线编程平台(如LeetCode、HackerRank)进行实战训练,提升编程和问题解决能力。此外,关注PPT中的编程代码也很关键,因为这些代码可能是老师给出的示例或解题思路,能够帮助学生更好地理解和掌握编程题的解法。因此,考生需要深入学习PPT内容,理解代码逻辑,并学会将其应用到实际编程题目中。 总之,对于
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值