Dive Into Python-Chapter 14 Test-First Programming

Dive Into Python-Chapter 14. Test-First Programming

Dive Into Python-Chapter 14. Test-First Programming

... Chapter 14. Test-First Programming 14. 1. roman.py, stage 1 Now that the unit tests are complete, it's time to start ... assertRaises was looking for. 14. 2. roman.py, stage 2 Now that you have the framework of the roman module laid out, it's time to start writing code and passing test cases. Example 14. 3. roman2.py This ... what's going on as each test case runs. With...

Ngày tải lên: 20/10/2013, 10:15

53 365 0
Dive Into Python-Chapter 16. Functional Programming

Dive Into Python-Chapter 16. Functional Programming

... /home/you/diveintopython/common/py/fullpath.py 1 sys.argv[0] = /home/you/diveintopython/common/py/fullpath.py path = /home/you/diveintopython/common/py full path = /home/you/diveintopython/common/py ... [you@localhost diveintopython]$ python common/py/fullpath.py 2 sys.argv[0] = common/py/fullpath.py path = common/py full path = /home/you/diveintopython/common/py [you@localhost divei...

Ngày tải lên: 24/10/2013, 09:15

36 301 0
Dive Into Python-Chapter 12. SOAP Web Services

Dive Into Python-Chapter 12. SOAP Web Services

... Certified Open Source: Pythonline http://www.pythonline.com/ Dive Into <b>Python</b> http://diveintopython.org/ Dive Into <b>Python</b>. <b>Python</b> from ... “python”. Example 12.2. Sample Usage of search.py C:\diveintopython\common\py> python search.py "python" <b>Python</b> Programming Language http://www.python.org/ H...

Ngày tải lên: 17/10/2013, 19:15

51 392 0
Dive Into Python-Chapter 13. Unit Testing

Dive Into Python-Chapter 13. Unit Testing

... Chapter 13. Unit Testing 13.1. Introduction to Roman numerals In previous chapters, you “dived in” by immediately looking at code and trying to understand it as quickly as possible. Now ... Study: Roman Numerals”, but now let's step back and consider what it would take to expand that into a two-way utility. The rules for Roman numerals lead to a number of interesting observations: ......

Ngày tải lên: 20/10/2013, 10:15

19 397 1
Dive Into Python-Chapter 15. Refactoring

Dive Into Python-Chapter 15. Refactoring

... fromRomanTable[s] def toRomanDynamic(n): """convert integer to Roman numeral using dynamic programming& quot;"" result = "" for numeral, integer in romanNumeralMap: ... test cases at once * Running unit tests in verbose or regular mode Further reading * XProgramming.com has links to download unit testing frameworks for many different lan...

Ngày tải lên: 24/10/2013, 09:15

49 269 0
Dive Into Python-Chapter 17. Dynamic functions

Dive Into Python-Chapter 17. Dynamic functions

... 'vacancies' 1 This regular expression turns vacancy into vacancies and agency into agencies, which is what you wanted. Note that it would also turn boy into boies, but that will never happen in the ... and quickly descends into more advanced uses. English is a schizophrenic language that borrows from a lot of other languages, and the rules for making singular noun...

Ngày tải lên: 28/10/2013, 16:15

36 344 0
Dive Into Python-Chapter 18. Performance Tuning

Dive Into Python-Chapter 18. Performance Tuning

... how it performs: C:\samples\soundex\stage1>python soundex1c.py Woo W000 14. 5341678901 Pilgrim P426 19.26500 7144 8 Flingjingwaller F452 30.1003563302 This code is straightforward, but ... the input: C:\samples\soundex\stage4>python soundex4b.py Woo W000 6.75477 4140 29 Pilgrim P426 7.5665 2144 337 Flingjingwaller F452 10.8727729362 The string method in soundex4b.py...

Ngày tải lên: 28/10/2013, 16:15

46 444 0
Dive Into Python-Chapter 1. Installing Python

Dive Into Python-Chapter 1. Installing Python

... it out: Welcome to Darwin! [localhost:~] you% python Python 2.2 (#1, 07 /14/ 02, 23:25:09) [GCC Apple cpp-precomp 6 .14] on darwin Type "help", "copyright", "credits", ... 1.1. Two versions of Python [localhost:~] you% python Python 2.2 (#1, 07 /14/ 02, 23:25:09) [GCC Apple cpp-precomp 6 .14] on darwin Type "help", "copyright", "...

Ngày tải lên: 07/11/2013, 10:15

20 332 0
Dive Into Python-Chapter 2. Your First Python

Dive Into Python-Chapter 2. Your First Python

... How Python's Datatypes Compare to Other Programming Languages An erudite reader sent me this explanation of how Python compares to other programming languages: statically typed language ... files. Some, like the sys module, are "built-in modules"; they are actually baked right into Python itself. Built-in modules behave just like regular modules, but their Python sou...

Ngày tải lên: 07/11/2013, 10:15

17 362 0
Dive Into Python-Chapter 3. Native Datatypes

Dive Into Python-Chapter 3. Native Datatypes

... values through string formatting  Mapping lists into other lists using list comprehensions  Splitting strings into lists and joining lists into strings is an important distinction that ... list of key-value pairs in the form key=value, and you want to join them into a single string. To join any list of strings into a single string, use the join method of a string object. H...

Ngày tải lên: 07/11/2013, 10:15

46 279 0
w