micropython

Change of docs/syspython.txt

637:114c62764785
docs/syspython.txt syspython-as-target
     1.1 --- a/docs/syspython.txt	Mon Feb 18 23:51:44 2013 +0100
     1.2 +++ b/docs/syspython.txt	Sat Feb 23 00:39:09 2013 +0100
     1.3 @@ -37,7 +37,36 @@
     1.4  Other than function definitions, no other code statements shall appear in
     1.5  class definitions; such statements will appear after classes have been
     1.6  defined in a __main__ function collecting together all "loose"
     1.7 -(module-level) statements.
     1.8 +(module-level) statements; class attribute assignments will occur in the
     1.9 +__main__ function, and where a name is associated with a function definition
    1.10 +and another object, the function will also be explicitly assigned in the
    1.11 +__main__ function using its full name.
    1.12 +
    1.13 +Any class or function defined once in a namespace need not be assigned to that
    1.14 +namespace in the __main__ function, but where multiple definitions exist and
    1.15 +program logic determines which definition prevails, such definitions must be
    1.16 +assigned in the __main__ function.
    1.17 +
    1.18 +For example:
    1.19 +
    1.20 +    class C:
    1.21 +        def method(self, ...):
    1.22 +            ...
    1.23 +        if something:
    1.24 +            method = something
    1.25 +
    1.26 +This is represented as follows:
    1.27 +
    1.28 +    class C:
    1.29 +        ...
    1.30 +        def method(self, ...):
    1.31 +            ...
    1.32 +
    1.33 +    def __main__():
    1.34 +        ...
    1.35 +        method = module.C.method
    1.36 +        if something:
    1.37 +            __storeaddress__(module.C, something)
    1.38  
    1.39  Imports
    1.40  -------
    1.41 @@ -105,12 +134,24 @@
    1.42  --------------------
    1.43  
    1.44  No operator usage: all operators are converted to invocations, including
    1.45 -all attribute access except static references to modules using the
    1.46 -following notation:
    1.47 +all attribute access except static references to modules or particular class
    1.48 +or function definitions using the following notation:
    1.49 +
    1.50 +    __static__(package)
    1.51 +    __static__(package.module)
    1.52 +    __static__(package.module.cls)
    1.53 +    __static__(package.module.cls.function)
    1.54  
    1.55 -    __module__(package)
    1.56 -    __module__(package.module)
    1.57 -    package.module              # shorthand where dot notation is used
    1.58 +A shorthand dot notation could be employed:
    1.59 +
    1.60 +    package.module
    1.61 +    package.module.cls
    1.62 +    package.module.cls.function
    1.63 +
    1.64 +Where multiple definitions of static objects occur, the dot notation cannot be
    1.65 +used, and the full name of such definitions must be quoted. For example:
    1.66 +
    1.67 +    __static__("package.module.cls#1.function")
    1.68  
    1.69  In general, attribute access must use an explicit function indicating the
    1.70  kind of access operation being performed. For example: