# HG changeset patch # User Paul Boddie # Date 1204150639 -3600 # Node ID 8422dd84e10478166472d34f7bf03292b0fc4a2f # Parent 8d3b1d59f0bfc66a46107a58082a51468c8c33f9 Added a summary table for attributes, contexts and values. Added a convenience function to the test program. diff -r 8d3b1d59f0bf -r 8422dd84e104 README.txt --- a/README.txt Mon Feb 25 00:54:11 2008 +0100 +++ b/README.txt Wed Feb 27 23:17:19 2008 +0100 @@ -39,6 +39,31 @@ object context reference reference +Acquiring Values +---------------- + +Values are acquired through name lookups and attribute access, yielding +the appropriate object reference together with a context reference as +indicated in the following table: + + Type of Access Context Notes + -------------- ------- ----- + + Local name Preserved Functions provide no context + + Global name Preserved Modules provide no context + + Class-originating Accessor Methods acquire the context of their + attribute -or- accessor if an instance... + Preserved or retain the original context if the + accessor is a class + + Instance-originating Preserved Methods retain their original context + attribute + +There is some scope for simplifying the above, to the detriment of Python +compatibility, since the unbound vs. bound methods situation can be confusing. + Objects ------- diff -r 8d3b1d59f0bf -r 8422dd84e104 test.py --- a/test.py Mon Feb 25 00:54:11 2008 +0100 +++ b/test.py Wed Feb 27 23:17:19 2008 +0100 @@ -7,6 +7,10 @@ for i, x in enumerate(importer.get_image()): print i, x +def attrs(obj): + for name, attr in obj.items(): + print name, attr + i = micropython.Importer(sys.path, "-v" in sys.argv) try: if len(sys.argv) < 2: