[OT] Half the download size

  • Thread starter Christos TZOTZIOY Georgiou
  • Start date
C

Christos TZOTZIOY Georgiou

Like most of us, I do my share of advocating python. So, there's this
good friend of mine, who is not a programmer, but he enjoys python
indirectly (ie I code some small utilities for him which he finds useful
enough in order to keep python installed :).
However, as good friends often do, he likes to tease my python
"obsession". Among other arguments to prove his claims wrong, I have
mentioned the plethora of people who have *contributed* (most of whom I
believe are mentioned in Misc/ACKS, to which file I have pointed my
friend in the past) as an indication that Python is not as unknown as he
would like it to be.

So, today he did a windows reinstallation on his home computer, and
called me to ask from where to download python. I point him to the url,
and he starts downloading. So, after a little while, he says:

-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".


PS Perhaps you didn't laugh like we did, but I sure hope you smiled;
anyway, since my friend and I have a running bet about python's
popularity being much, much bigger in datetime.timedelta(1747) days,
please people, help me out spreading Python's use; this is a bet I can't
afford to lose ;-)
 
A

Anton Vredegoor

Christos "TZOTZIOY" Georgiou said:
-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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top