栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Access to computer science and programming by python

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Access to computer science and programming by python

instructed by Ana Bell and John V. Guttag; very first class; getting started

term-knowledge
  • declarative knowledge
  • imperative knowledge
term-computer
  1. fixed program
  2. stored program

odd as this may sound, both the program and the data it manipulates reside in memory<

flow of control, like testing and jumping, is essential to allowing us to write programs that perform complex tasks

computers can be annoyingly literal

term-algorithm

detail the computation as a  sequence of instructions

a finite of instructions>>describe a computation that will proceed through and eventually produce an output when executed on an input<

include some  tests for deciding whether the process is complete, for jumping to a specific instruction

returning to the recipe metaphor, given a fixed set of ingredients a good chef can make an unbounded number of tasty dishes by combining them in diff. ways>>similarly, given a small fixed set of primitive features a good programmer can produce an unbounded number of useful programs

to create a recipe, programming language is needed to describe it and give the computer its marching orders

some things may be easiler to program in a particular language; whatever set of primitives one has, and whatever methods one has for using them, the best and worst thing about programming are the same: the computer will do exactly what you tell it to do.>>make it do all sorts of fun, useful and boring things.

MATLAB is a good laguage for manipulating matrices

Python

is good general-purpose language

primitive constructs in Python  include literals and infix operators

judge whether a string of primitive constructs is syntactically valid

static semantics>>1.2/a isn't valid

the semantics of a language associte a meaning with each syntactically correct string of symbols that has no static semantic errors

Python does do a considerable amount of semantic checking while running a program

however, a sentence has semantcis is not sure to have the same semantics that its creator intended it to have

English by analogy with a natural language

primitive constructs are words

syntax describes which strings of words constitute well-formed sentences

static semantics defines which sentences are meaningful

semantics defines the meaning of those sentences

Error
  • might crash and do damage to the overall system>>Almost everyone who uses a personal computer has run a program that has managed to make it necessary to restart the whole computer.
  • might keep runing, and running, and never stop
  • may creat answer that might, or might not, be correct

whenever possible, programs should be written in such a way that when they don't work properly, it is self-evident.


Into the world of python though each programming language is different, there are some dimensions along which they can be related
  • whether we program using instructions and data objects at the level of the machine or using more abstract operations
  • general versus targeted to an application domain refers to whether the primitive operations of the programming language are widely applicable or are fine-tuned to a domain
  • interpreted versus compiled refres to whether the sequence of instructions written by the programmer, called source code, is executed directly or whether it's first converted into a sequence of machine-level primitive operations.

this book,  we use Python. However, this book is not about python. It will certainly help reader learn Python, and that's a good thing.

what's much more important, however, is that careful readers will learn something about how to write programs that solve problems. 

This skill can be transferred to any programming language

weak static semantic checking>>Python isn't optimal for programs that have high reliability constraints or that is built and maintained by  many people over a long period of time

is designed to be interpreted>>provide the kind of runtime feedback that's especially helpful to novice programmers

a living language>>

  • a large number of freely available libraries that interface to Python>>provide useful extended functionality. Several of this are used in this book.
  • since its introduction in 1990 by Guido van Rossum, it has undergone many changes>>for the first decade of its life, Python was a little known and little used language; that changed with the arrival of Python 2.0 in 2000: incorporate a number of important improvements to the language iteslf, it marked a shift in the evolutionary path of the language, a lot of people began developing libraries that interfaced seamlessly withPython, and continuing suppory and development of its ecosystem became a community-based activity; 3.0 released at the end of 2008, cleaning up many of inconsistencies

those are common to almost all programming language, though not necessary in detail

the language is presented in dribs and drabs(三三两两,好喜欢这个描述), as needed for this ulterior(隐秘的) purpose

Python program/script>>instructions>>definitions and commands

experienced programmers will confirm that they spend a great deal of time reading programs in an attempt to understand why they behave as they do>>it's therefore of critical importance to write programs in a way that they are easy to read>>apt恰当的choice of variable names play an important role in enchancing readability

there is no a priori reason to suspect that anything is amiss不恰当的

prompt us to be suspicious that something is wrong

straight-line programs are downright boring彻头彻尾无趣

indentation>.it ensures that the visual structure of a program is an accurate representation of the semantic structure of that program

ASCII>>a standard for the internal representation of 128 characters, not enough to cover the characters and accents appearing in all the world's languages

in recent years, there has been a shift to Unicode>>120,000 different characters>>can be implemented using different internal chracter encodings

# -*- coding: utf-8 -*- 

the most frequently used character encoding for World Wide Web pages

we have now covered pretty much everything about Python that we need to know to start writing interesting programs 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/664686.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号