(continued from previous page@staticmethod def )the same concept exists for classesbut is less commonly used there see the documentation for function definitions and class definitions for more about decorators descriptor any object which defines the methods __get__()__set__()or __delete__(when class attribute is descriptorits special binding behavior is triggered upon attribute lookup normallyusing to getset or delete an attribute looks up the object named in the class dictionary for abut if is descriptorthe respective descriptor method gets called understanding descriptors is key to deep understanding of python because they are the basis for many features including functionsmethodspropertiesclass methodsstatic methodsand reference to super classes for more information about descriptorsmethodssee descriptors dictionary an associative arraywhere arbitrary keys are mapped to values the keys can be any object with __hash__(and __eq__(methods called hash in perl dictionary view the objects returned from dict keys()dict values()and dict items(are called dictionary views they provide dynamic view on the dictionary' entrieswhich means that when the dictionary changesthe view reflects these changes to force the dictionary view to become full list use list(dictviewsee dict-views docstring string literal which appears as the first expression in classfunction or module while ignored when the suite is executedit is recognized by the compiler and put into the __doc__ attribute of the enclosing classfunction or module since it is available via introspectionit is the canonical place for documentation of the object duck-typing programming style which does not look at an object' type to determine if it has the right interfaceinsteadthe method or attribute is simply called or used ("if it looks like duck and quacks like duckit must be duck "by emphasizing interfaces rather than specific typeswell-designed code improves its flexibility by allowing polymorphic substitution duck-typing avoids tests using type(or isinstance((notehoweverthat duck-typing can be complemented with abstract base classes insteadit typically employs hasattr(tests or eafp programming eafp easier to ask for forgiveness than permission this common python coding style assumes the existence of valid keys or attributes and catches exceptions if the assumption proves false this clean and fast style is characterized by the presence of many try and except statements the technique contrasts with the lbyl style common to many other languages such as expression piece of syntax which can be evaluated to some value in other wordsan expression is an accumulation of expression elements like literalsnamesattribute accessoperators or function calls which all return value in contrast to many other languagesnot all language constructs are expressions there are also statements which cannot be used as expressionssuch as if assignments are also statementsnot expressions extension module module written in or ++using python' api to interact with the core and with user code -string string literals prefixed with 'for 'fare commonly called " -stringswhich is short for formatted string literals see also pep file object an object exposing file-oriented api (with methods such as read(or write()to an underlying resource depending on the way it was createda file object can mediate access to real on-disk file or to another type of storage or communication device (for example standard input/outputin-memory bufferssocketspipesetc file objects are also called file-like objects or streams there are actually three categories of file objectsraw binary filesbuffered binary files and text files their interfaces are defined in the io module the canonical way to create file object is by using the appendix glossary