Decoupling the version of the file from the name of the module.

bobueland at yahoo.com bobueland at yahoo.com
Sat Jan 28 17:28:39 EST 2006


 Xavier Morel wrote:
> Just get rid of the version number in the name (what's the point) and
>define a __version__ attribute in the module, that's what is usually done.

Thanks Xavier, but as I said I'm newbie and I'm not sure how to do
that. Here's my module

# circle.py
from math import pi

__version__ = '1.0'

def disk(r):
    """Returns the area of the disk with radius r."""
    return (pi * r**2)

def test():
    print disk(1)
    print disk(2)

# end of the module


Now suppose I have make a new version with __version__ = 1.1. What
shall I call this file and (I don't want to overwrite the old file if I
need to go back to it) how do I import it from the shell. Your advice
sounds nice, but I would appreciate if you could give me (or point me
to) a simple example.

Thanks




More information about the Python-list mailing list