Dive Into Python

Dive Into Python

作者:Mark Pilgrim

出版社:Apress

出版年:2004-11-5

评分:8.2

ISBN:9781590593561

所属分类:行业好书

书刊介绍

内容简介

Python is a new and innovative scripting language. It is set to replace Perl as the programming language of choice for shell scripters, and for serious application developers who want a feature-rich, yet simple language to deploy their products.

Dive Into Python is a hands-on guide to the Python language. Each chapter starts with a real, complete code sample, proceeds to pick it apart and explain the pieces, and then puts it all back together in a summary at the end.

This is the perfect resource for you if you like to jump into languages fast and get going right away. If youre just starting to learn Python, first pick up a copy of Magnus Lie Hetland's Practical Python.

作者简介

Mark Pilgrim is an accessibility architect in the IBM Emerging Technologies Group. He is the author of several technical books,

including Dive Into Accessibility, a free online tutorial on web accessibility. He lives in North Carolina with his wife and newborn son, and spends his copious free time sunbathing, skydiving, and

reading Immanuel Kant's Critique of Pure Reason.

精彩摘录

Atupleisanimmutablelist.AtublecanNOTbechangedinanywayonceitiscreated.TuplesHaveNoMethods

——引自第1页


>>>importtimeit>>>t=timeit.Timer("soundex.soundex('Pilgrim')",..."importsoundex")>>>t.timeit()8.21683733547>>>t.repeat(3,2000000)[16.48319309109,16.46128984923,16.44203948912] 1.Thetimeitmoduledefinesoneclass,Timer,whichtakestwoarguments.Bothargumentsarestrings.Thefirstargumentisthestatementyouwishtotime;inthiscase,youaretimingacalltotheSoundexfunctionwithinthesoundexwithanargumentof'Pilgrim'.ThesecondargumenttotheTimerclassistheimportstatementthatsetsuptheenvironmentforthestatement.Internally,timeitsetsupanisolatedvirtualenvironment,manuallyexecutesthesetupstatement(importingthesoundexmodule),thenmanuallycompilesandexecutesthetimedstatement(callingtheSoun...

——引自章节:18.2.UsingthetimeitModule

相关推荐

微信二维码