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.

classes (continued)objects (see objects)persistence, 527pseudoprivate attributes, 543–545why use, 544user-defined (see user-defined classes)versus modules, 537why use, 452–453composition, 452customization via inheritance, 453inheritance, 452multiple instances, 452operator overloading, 453classtree function, 511closure, 321_ _cmp_ _ method, 492codecommon coding gotchas, 291–292compiling, 25documenting (see documenting code)nested, 214reuse, 386, 459–462strings, 143coding basics, 465–480calling objects, 466classes intercepting <strong>Python</strong>operators, 472–476example, 474–475inheritance (see inheritance)multiple instance objects, 465–469concrete items, 466default behavior, 466example, 467–469inheritance, 466self, 466operator overloading, 475simple <strong>Python</strong> class, 476–478cohesion, 369COM support on MS Windows, 11command-line arguments, 137comments, 38, 99, 239comparisons, 186–189languages, 18operators, 96compiled extensions, 630compilingbyte code, 25extensions, 7Psyco just-in-time compiler, 29Shedskin, 29complex numbers, 95, 104componentsintegration, 4, 10merging, 31composition, 452, 523–527example, 524–527compound statements, 37, 236–247compound types, 371concatenation, 71, 123strings, 132concept hierarchy, 201configuration (see installation andconfiguration)constraints, trapping, 595context management, 596–600protocol, 598–600contextlib standard module, 600continue statement, 202, 250, 251control flows, unusual, 577control language, 6conversion, strings, 97copies versus references, 184–186coupling, 369C<strong>Python</strong>, 28cross-file changes, minimizing, 318cross-file name changes, 402csh shell, 644current working directory, 392customization via inheritance, 453cyclic data structures, 193DDabo, 10data attributes, 482data structures, 66database programming, 11databases, 11_ _debug_ _ flag, 595debugger (IDLE), 54debuggers, 632decimal numbers, 87decimal object, 107declaration statementsmissing, 112–116def statements, 202, 301, 302–304, 483return, yield, 299versus lambda, 345default argument values, 323default exception handler, 578defaults, 373_ _del_ _ method, 492, 505del statement, 203684 | Index

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

Saved successfully!

Ooh no, something went wrong!