Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword or section
Like this
22Activity
0 of .
Results for:
No results containing your search query
P. 1
pythonbook-2.5

pythonbook-2.5

Ratings: (0)|Views: 394 |Likes:
Published by Madi
We have to adopt a style for presenting Python. We won't present a complete set of coding
standards, instead we'll present examples. This section has some justification of the style we
use for the examples in this book.
Just to continune this rant, we find that actual examples speak louder than any of the
gratuitously detailed coding standards which are so popular in IT shops. We find that many
IT organizations waste considerable time trying to write descriptions of a preferred style. A
good example, however, trumps any description. As consultants, we are often asked to
provide standards to an inexperienced team of programmers. The programmers only look at
the examples (often cutting and pasting them). Why spend money on empty verbiage that is
peripheral to the useful example?
One important note: we specifically reject using complex prefixes for variable names.
Prefixes are little more than visual clutter. In many places, for example, an integer parameter
with the amount of a bet might be called pi_amount where the prefix indicates the scope (p
for a parameter) and type (i for an integer). We reject the pi_ as useless and uninformative.
This style of name is only appropriate for primitive types, and doesn't address complex data
We have to adopt a style for presenting Python. We won't present a complete set of coding
standards, instead we'll present examples. This section has some justification of the style we
use for the examples in this book.
Just to continune this rant, we find that actual examples speak louder than any of the
gratuitously detailed coding standards which are so popular in IT shops. We find that many
IT organizations waste considerable time trying to write descriptions of a preferred style. A
good example, however, trumps any description. As consultants, we are often asked to
provide standards to an inexperienced team of programmers. The programmers only look at
the examples (often cutting and pasting them). Why spend money on empty verbiage that is
peripheral to the useful example?
One important note: we specifically reject using complex prefixes for variable names.
Prefixes are little more than visual clutter. In many places, for example, an integer parameter
with the amount of a bet might be called pi_amount where the prefix indicates the scope (p
for a parameter) and type (i for an integer). We reject the pi_ as useless and uninformative.
This style of name is only appropriate for primitive types, and doesn't address complex data

More info:

Categories:Types, Research
Published by: Madi on Sep 06, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/11/2014

pdf

text

original

 
Building Skills in Pythonfile:///Volumes/SLOTT02/Writing/Technical/PythonBook-2.5/python...1 of 4581/27/08 9:01 PM
Building Skills in PythonA Programmer's Introduction to PythonSteven F. Lott
Copyright © 2002, 2005, 2007, 2008 Steven F. LottThis work is licensed under a Creative Commons License. You are free to copy, distribute,display, and perform the work under the following conditions:
Attribution.
You must give the original author, Steven F. Lott, credit.
Noncommercial.
You may not use this work for commercial purposes.
No Derivative Works.
You may not alter, transform, or build upon this work.For any reuse or distribution, you must make clear to others the license terms of this work.1/28/2008
Table of Contents
PrefaceWhy Read This Book?AudienceOrganization of This BookLimitationsProgramming StyleConventions Used in This BookAcknowledgementsI. Language Basics1. Background and HistoryHistoryFeatures of PythonComparisons2. Python InstallationWindows InstallationMacintosh InstallationGNU/Linux and UNIX OverviewYUM InstallationRPM Installation"Build from Scratch" Installation3. Getting StartedCommand-Line InteractionThe IDLE Development EnvironmentScript ModeSyntax FormalitiesExercisesOther ToolsStyle Notes: Wise Choice of File Names4. Simple Numeric Expressions and OutputThe
 
print
StatementNumeric Types and OperatorsNumeric Conversion FunctionsBuilt-In FunctionsExpression Exercises
 
Building Skills in Pythonfile:///Volumes/SLOTT02/Writing/Technical/PythonBook-2.5/python...2 of 4581/27/08 9:01 PM
Expression Style Notes5. Advanced ExpressionsUsing ModulesThe
math
ModuleThe
random 
ModuleAdvanced Expression ExercisesBit Manipulation OperatorsDivision Operators6. Variables, Assignment and InputVariablesThe
Assignment
StatementInput FunctionsMultiple Assignment StatementThe
del
StatementInteractive Mode RevisitedVariable and Assignment ExercisesVariables and Assignment Style Notes7. Truth, Comparison and Conditional ProcessingTruth and LogicComparisonsConditional Processing: the
if 
StatementThe
 
pass
StatementThe
assert
StatementThe
if-else
OperatorCondition ExercisesCondition Style Notes8. LoopingIterative Processing: For All and There ExistsIterative Processing: The
for
StatementIterative Processing: The
while
StatementMore Iteration Control:
break
and
continue
Iteration ExercisesCondition and Loops Style NotesA Digression9. FunctionsSemanticsFunction Definition: The
def 
and
return
StatementsFunction UseFunction VarietiesSome ExamplesHacking ModeMore FeaturesFunction ExercisesObject Method FunctionsFunctions Style Notes10. Additional Notes On FunctionsFunctions and NamespacesThe
global
StatementCall By Value and Call By ReferenceFunction ObjectsII. Data Structures11. Sequences: Strings, Tuples and ListsSemanticsOverview of SequencesExercisesStyle Notes12. StringsString SemanticsString Literal ValuesString OperationsString Comparison OperationsString Built-in FunctionsString Methods
 
Building Skills in Pythonfile:///Volumes/SLOTT02/Writing/Technical/PythonBook-2.5/python...3 of 4581/27/08 9:01 PM
String ModulesString ExercisesDigression on Immutability of Strings13. TuplesTuple SemanticsTuple Literal ValuesTuple OperationsTuple Comparison OperationsTuple StatementsTuple Built-in FunctionsTuple ExercisesDigression on The Sigma Operator14. ListsList SemanticsList Literal ValuesList OperationsList Comparison OperationsList StatementsList Built-in FunctionsList MethodsList Exercises15. Mappings and DictionariesDictionary SemanticsDictionary Literal ValuesDictionary OperationsDictionary Comparison OperationsDictionary StatementsDictionary Built-in FunctionsDictionary MethodsDictionary ExercisesAdvanced Parameter Handling For Functions16. SetsSet SemanticsSet Literal ValuesSet OperationsSet Comparison OperatorsSet StatementsSet Built-in FunctionsSet MethodsSet Exercises17. ExceptionsException SemanticsBasic Exception HandlingRaising ExceptionsAn Exceptional ExampleComplete Exception Handling and The
finally
ClauseException FunctionsException AttributesBuilt-in ExceptionsException ExercisesStyle NotesA Digression18. Generators and the
 
yield
StatementGenerator SemanticsDefining a GeneratorGenerator FunctionsGenerator StatementsGenerator MethodsGenerator ExampleGenerator ExercisesSubroutines and Coroutines19. FilesFile Semantics

Activity (22)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Kalpita Karmadi liked this
ginam liked this
pn360 liked this
wyjyan liked this
vjsbali liked this
eagle_aviator liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->