# HG changeset patch # User Paul Boddie # Date 1192394770 -7200 # Node ID dff259dd9f5e0f6f2ab65449c73163ec5fbf3e85 # Parent 7072be5017678f2b34c4e8c39a9014359a90c737 Added an issues document which discusses the obstacles in processing Python source code and generating executable program code. diff -r 7072be501767 -r dff259dd9f5e docs/issues.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/issues.txt Sun Oct 14 22:46:10 2007 +0200 @@ -0,0 +1,36 @@ +Code Generation and Optimisation Issues +======================================= + +Python's dynamic nature provides a few issues which obstruct the generation of +optimised code. + +Attribute and Method Selection +------------------------------ + +Python provides a kind of shadowing of attributes so that objects which do not +provide a particular attribute can still appear to provide such an attribute +via the object's class or base classes. If access via the object or the class +are both possible for a particular case, two different kinds of access would +need to be provided at that location in the program. + +Unlike other languages, methods and non-method attributes are interchangeable +and are provided by objects or classes. Consequently, distinctions between +attributes and methods, with special rules for method selection (virtual vs. +non-virtual) do not exist. Moreover, unlike some languages such as C++ where +explicit qualification of an object's type can be used to reference an +attribute - for example, by saying that an object is of type X, an attribute +can be located using knowledge of the structure of instances of X - such +qualification does not take place in Python programs, and such knowledge must +be provided by other means. + +Parameter Structures +-------------------- + +Python provides some complicated ways of passing parameters to functions and +methods, such as keyword arguments and "overflow" parameters (star and dstar +parameters). Consequently, if parameter values are to be put on a stack and +given to a function, resolution of keyword arguments and "excess" arguments +(of both positional and keyword varieties) must take place. This is made even +more complicated by the possibility that at a given invocation site, many +potentially incompatible functions may be called, each with their own optimal +parameter ordering.