micropython

Annotated tests/failure/importer_module_attribute_assignment.py

242:2a64685ab6dc
2009-06-12 Paul Boddie Fixed module attributes to behave like class attributes and officially be recognised as being statically positioned. Improved test coverage of module attributes.
paul@242 1
#!/usr/bin/env python
paul@242 2
paul@242 3
import imported
paul@242 4
paul@242 5
class C:            # hack: make an attribute called y known to the system
paul@242 6
    y = None        # hack: this prevents compilation errors with the statements
paul@242 7
                    # hack: below
paul@242 8
paul@242 9
n = None
paul@242 10
n = imported
paul@242 11
n.a = 1             # not detected due to reassignment of n
paul@242 12
n.y = 2             # not detected due to reassignment of n
paul@242 13
n.y = 3             # not detected due to reassignment of n
paul@242 14
paul@242 15
# vim: tabstop=4 expandtab shiftwidth=4