Commit Graph

19 Commits

Author SHA1 Message Date
Fred Drake 6e99704fcf Add a deprecation warning to reflect the documented deprecation of the
whrandom module.  (The deprecation was effective in Python 2.1.)
2002-04-10 01:45:11 +00:00
Tim Peters e119006e7d Whitespace normalization. Top level of Lib now fixed-point for reindent.py! 2001-01-15 03:34:38 +00:00
Fred Drake 0412e494b8 Line-wrap and properly indent a couple of docstrings. 2000-06-30 19:33:35 +00:00
Guido van Rossum 98d9fd3e68 Simple changes by Gerrit Holl - move author acknowledgements out of
docstrings into comments.
2000-02-28 15:12:25 +00:00
Guido van Rossum e7b146fb3b The third and final doc-string sweep by Ka-Ping Yee.
The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.

A new docstring was added to formatter.  The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
2000-02-04 15:28:42 +00:00
Guido van Rossum cc221c470f Fixed a few lines that tabnanny complained about (one space before the
tabs).
1998-08-10 20:07:53 +00:00
Guido van Rossum 187f154243 Introducing randrange([start,] stop [,step]) -- same as
choice(range(start, stop, step)) but faster.  This addresses the
problem that randint() was accidentally defined as taking an inclusive
range (how unpythonic).

The code is longish because Tim Peters insisted that it reject
non-integral arguments while I insisted that it be not much slower
than randint(); the compromise satisfies both but is somewhat
convoluted.

Also changed randint() to be implemented through randrange().  This is
a semantic change because old randint() didn't test its arguments for
validity.  (It also makes randrange() win any contest with randint()
:-)
1998-07-31 13:39:44 +00:00
Guido van Rossum cc20b76ad0 Add comments explaining thread unsafety of this code. 1998-05-29 17:51:59 +00:00
Guido van Rossum 358473c1a2 Andrew Kuchling writes:
First, the RNG in whrandom.py sucks if you let it seed itself from the time.
The problem is the line:
			t = int((t&0xffffff) | (t>>24))
Since it ORs the two parts together, the resulting value has mostly
ON bits.  Change | to ^, and you don't lose any randomness.
1998-02-16 14:52:42 +00:00
Guido van Rossum d247812521 Two improvements suggested by Tim Peters: speed up random() since we
know Python integers are at least 32 bits long; and avoid zeros in
initial seed value.
1997-07-10 15:14:50 +00:00
Guido van Rossum 6757748641 Properly parenthesize a long Boolean combination. Formerly, you could
pass invalid seed values.
1997-01-02 18:13:35 +00:00
Guido van Rossum 9cb018e693 Change the default seeding -- use 8 bits of sub-second precision and
fold in the higest 8 bits of the time as well.
1996-10-21 23:20:03 +00:00
Guido van Rossum 14a6e3d5e8 * Lib/whrandom.py: if seed is (0,0,0), initialize from current
time; default seed's arguments to (0,0,0)
1994-09-14 13:33:57 +00:00
Guido van Rossum 3bb5448767 New way of generating .pyc files, thanks to Sjoerd.
urllib.py: '+' is not always safe (even though the RFC says so :-( )
whrandom.py: throw away top bits of time to avoid overflow on Mac
(where times can be negative)
1994-08-29 10:52:58 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum 7bc817d5ba * Mass change: get rid of all init() methods, in favor of __init__()
constructors.  There is no backward compatibility.  Not everything has
  been tested.
* aiff.{py,doc}: deleted in favor of aifc.py (which contains its docs as
  comments)
1993-12-17 15:25:27 +00:00
Guido van Rossum fea2af1e9b * More changes due to stricter argument passing rules
* Fixed calendar.py, mimetools.py, whrandom.py to cope with time.time()
  returning a floating point number.  (And fix old bug in calendar)
* Add recursion level to mainloop.mainloop(), to make it reentrant.
1993-01-04 09:16:51 +00:00
Guido van Rossum 2db91358de Misc changes and new modules. whrandom is "objectified". SOCKET.py
is moved to the sgi subdirectory.
1992-10-18 17:09:59 +00:00
Guido van Rossum c636014c43 Initial revision 1990-10-13 19:23:40 +00:00