pythonic equivalent of upvar?

Fredrik Lundh fredrik at pythonware.com
Tue Dec 20 15:42:15 CET 2005


David MacKay wrote:

> def main():
>    ## Define DEFAULTS that can be overridden on the command line
>    decode=0    ## are we decoding?
>    verbose=0   ## verbose output?
>    bits=7      ## how big are the blocks?
>    N = 10000   ## What is the file length?
>    file="blah" ## file name string

    class options:
        decode = False # are we decoding?
        verbose = False # verbose output?
        bits = 7 # how big are the blocks?
        N = 10000 # What is the file length?
        file = "blah" # file name string

    read_options(options)

</F> 






More information about the Python-list mailing list