12.07.2015 Views

Is Python a

Is Python a

Is Python a

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Kkeyed-access files, 86KeyError (built-in exception), 614keyword arguments, 331, 332, 340passing, 351Komodo, 55, 632ksh shell, 644Llambda, 299body, 345nested, 348operators, 96versus def, 345why use, 346lambda expressions, 324, 344lambda functions, 344–349language changes, xxxiilanguages, comparisons to, 18–19large character sets, encoding, 130launch options, 57LEGB rule, 312, 317, 407len function, 70, 162, 300_ _len_ _ method, 492lexical scoping, 311library utilities, 15limitations, 7line indentation, 240Linux, 13list comprehensions, 78, 260, 263, 272–275,355–360basics, 272, 355extended syntax, 274files, 273for loops and, 360generator expressions, 365map and, 361matrixes and, 358tests and nested loops, 356–358tuples and, 175list function, 119, 146, 175, 264lists, 67, 75–79, 152–160accessed by offset, 152arrays of object references, 153basic operations, 154bounds checking, 77category mutable sequence, 153changing in-place, 156common list operations, 159common literals and operations, 153comprehension (see list comprehensions)index assignments, 157indexing, 155inside tuples, 175main properties, 152matrixes, 156method calls, 157nesting, 77ordered collections of arbitraryobjects, 152sequence operations, 76slice assignment, 157slicing, 155type-specific operations, 76variable-length, heterogeneous, andarbitrarily nestable, 153literalsfloating-point, 94hexadecimal and octal, 95long integer, 94numbers, 94local names, 372local scopes, 311, 312local variables, 308, 318logical operators, 96long integer literals, 94long integers, 94, 103Loop else block, 250loop variables, 324loops, 248–277break statement, 250coding techniques, 265–271changing lists, 267counter loops, 265generating offests and items, 271nonexhaustive traversals, 266parallel traversals, 268continue statement, 250, 251else clause, 252emulating C while loops, 255for (see for loops)general format, 250interactive, 210–214doing math on user inputs, 211nested code, 214simple, 210testing inputs, 212iterators, 258–264file scanners, 259files, 260–262iteration protocol, 261other built-in type, 262other iteration contexts, 263–264StopIteration exception, 260user-defined, 264Index | 691

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!