[OT] Half the download size

Anton Vredegoor anton at vredegoor.doge.nl
Wed Sep 17 10:48:48 EDT 2003


Christos "TZOTZIOY" Georgiou <tzot at sil-tec.gr> wrote:

>-Hm... Python is quite big...
>-Yes, it's the philosophy I told you about, "batteries included".  Lots
>of useful stuff.
>-Is this the reason, or is it that I'm also downloading the huge list of
>contributors? ;-)
>-Ah! Sorry, my mistake, pointed you to the wrong URL... you should click
>the other one that's half the size.
>-Which one?
>-The one under the name of... uh... "Ungrateful Python".

Yes it's a problem. There's too much useful stuff and the list of
developers gets longer and longer. However the following script could
be used to generate a placebo Python contributors list (after
installation) at a fraction of the download size. It also shows that
the problem won't be significant unless the number of contributors
gets way bigger than 10000.

Anton

from random import sample,randint
from string import ascii_lowercase,capitalize
from zipfile import ZipFile,ZIP_DEFLATED

def newname(minfirst,maxfirst,minlast,maxlast):
    nfirst = randint(minfirst,maxfirst)
    nlast = randint(minlast,maxlast)
    firstname = "".join(sample(ascii_lowercase,nfirst))
    lastname = "".join(sample(ascii_lowercase,nlast))
    return " ".join(map(capitalize,[firstname,lastname]))

def main():
    textfilename = "contributors.txt"
    archivename = "contributors.zip"
    n = 10000
    minfirst,maxfirst,minlast,maxlast = 3,10,4,20
    tup = minfirst,maxfirst,minlast,maxlast
    names = [newname(*tup) for i in range(n)]
    f = open(textfilename,"w")
    for name in names:   f.write("%s\n" %name)
    f.close()
    Z = ZipFile(archivename,'w',ZIP_DEFLATED)
    Z.write(textfilename)
    Z.close()

if __name__=='__main__':
    main()





More information about the Python-list mailing list