]> granicus.if.org Git - python/log
python
24 years agoAdd TODO item about x in y -- this should use iterators too, IMO.
Guido van Rossum [Fri, 4 May 2001 13:40:18 +0000 (13:40 +0000)]
Add TODO item about x in y -- this should use iterators too, IMO.

24 years agoAdded reminders to make some remaining functions iterator-friendly. Feel
Tim Peters [Fri, 4 May 2001 04:43:42 +0000 (04:43 +0000)]
Added reminders to make some remaining functions iterator-friendly.  Feel
free to do one!

24 years agoGeneralize reduce() to work with iterators.
Tim Peters [Fri, 4 May 2001 04:39:21 +0000 (04:39 +0000)]
Generalize reduce() to work with iterators.
NEEDS DOC CHANGES.

24 years agoPurge redundant cut&paste line.
Tim Peters [Thu, 3 May 2001 23:58:47 +0000 (23:58 +0000)]
Purge redundant cut&paste line.

24 years agoGeneralize map() to work with iterators.
Tim Peters [Thu, 3 May 2001 23:54:49 +0000 (23:54 +0000)]
Generalize map() to work with iterators.
NEEDS DOC CHANGES.
Possibly contentious:  The first time s.next() yields StopIteration (for
a given map argument s) is the last time map() *tries* s.next().  That
is, if other sequence args are longer, s will never again contribute
anything but None values to the result, even if trying s.next() again
could yield another result.  This is the same behavior map() used to have
wrt IndexError, so it's the only way to be wholly backward-compatible.
I'm not a fan of letting StopIteration mean "try again later" anyway.

24 years agoThe weakref support in PyObject_InitVar() as well; this should have come out
Fred Drake [Thu, 3 May 2001 20:04:33 +0000 (20:04 +0000)]
The weakref support in PyObject_InitVar() as well; this should have come out
at the same time as it did from PyObject_Init() .

24 years agoRemove unnecessary intialization for the case of weakly-referencable objects;
Fred Drake [Thu, 3 May 2001 19:44:50 +0000 (19:44 +0000)]
Remove unnecessary intialization for the case of weakly-referencable objects;
the code necessary to accomplish this is simpler and faster if confined to
the object implementations, so we only do this there.

This causes no behaviorial changes beyond a (very slight) speedup.

24 years agoRemove an obsolete comment and a "return" before fallig off the end of a
Fred Drake [Thu, 3 May 2001 16:05:46 +0000 (16:05 +0000)]
Remove an obsolete comment and a "return" before fallig off the end of a
void function.

24 years agoSince Py_TPFLAGS_HAVE_WEAKREFS is set in Py_TPFLAGS_DEFAULT, it does not
Fred Drake [Thu, 3 May 2001 16:04:13 +0000 (16:04 +0000)]
Since Py_TPFLAGS_HAVE_WEAKREFS is set in Py_TPFLAGS_DEFAULT, it does not
need to be specified in the type structures independently.  The flag
exists only for binary compatibility.

This is a "source cleanliness" issue and introduces no behavioral changes.

24 years agoRemove redundant copy+paste code.
Tim Peters [Thu, 3 May 2001 07:09:25 +0000 (07:09 +0000)]
Remove redundant copy+paste code.

24 years agoGeneralize max(seq) and min(seq) to work with iterators.
Tim Peters [Thu, 3 May 2001 07:00:32 +0000 (07:00 +0000)]
Generalize max(seq) and min(seq) to work with iterators.
NEEDS DOC CHANGES.

24 years agoInteractiveInterpreter.showsyntaxerror():
Fred Drake [Thu, 3 May 2001 04:58:49 +0000 (04:58 +0000)]
InteractiveInterpreter.showsyntaxerror():
    When replacing the exception object, be sure we stuff the new value
    in sys.last_value (which we already did for the original value).

24 years agoAdded support for .__contains__(), .__iter__(), .iterkeys().
Fred Drake [Thu, 3 May 2001 04:55:47 +0000 (04:55 +0000)]
Added support for .__contains__(), .__iter__(), .iterkeys().

24 years agoAdded support for .iteritems(), .iterkeys(), .itervalues().
Fred Drake [Thu, 3 May 2001 04:54:41 +0000 (04:54 +0000)]
Added support for .iteritems(), .iterkeys(), .itervalues().

24 years agoThe general iteration support is part of 2.2, not 2.1 -- fixed the version
Fred Drake [Thu, 3 May 2001 04:39:10 +0000 (04:39 +0000)]
The general iteration support is part of 2.2, not 2.1 -- fixed the version
annotations!

Also fixed a typo noted by Neil S.

24 years agoAdd documentation for the StopIteration exception.
Fred Drake [Thu, 3 May 2001 04:30:45 +0000 (04:30 +0000)]
Add documentation for the StopIteration exception.

24 years agoState that Mailbox objects are iterator objects.
Fred Drake [Wed, 2 May 2001 20:22:12 +0000 (20:22 +0000)]
State that Mailbox objects are iterator objects.

24 years agoMake the Mailbox objects support iteration -- they already had the
Fred Drake [Wed, 2 May 2001 20:20:53 +0000 (20:20 +0000)]
Make the Mailbox objects support iteration -- they already had the
appropriate next() method, and this is what people really want to do with
these objects in practice.

24 years agoUpdate the filter() and list() descriptions to include information about
Fred Drake [Wed, 2 May 2001 20:19:19 +0000 (20:19 +0000)]
Update the filter() and list() descriptions to include information about
the support for containers and iteration.

24 years agoAdded section describing the iterator protocol.
Fred Drake [Wed, 2 May 2001 20:18:03 +0000 (20:18 +0000)]
Added section describing the iterator protocol.

24 years agoAdded new parser markers 'et' and 'et#' which do not recode string
Marc-André Lemburg [Wed, 2 May 2001 17:16:16 +0000 (17:16 +0000)]
Added new parser markers 'et' and 'et#' which do not recode string
objects but instead assume that they use the requested encoding.

This is needed on Windows to enable opening files by passing in
Unicode file names.

24 years agoMchael Hudson pointed out that the code for detecting changes in
Guido van Rossum [Wed, 2 May 2001 15:13:44 +0000 (15:13 +0000)]
Mchael Hudson pointed out that the code for detecting changes in
dictionary size was comparing ma_size, the hash table size, which is
always a power of two, rather than ma_used, wich changes on each
insertion or deletion.  Fixed this.

24 years agoFix for bug #417030: "print '%*s' fails for unicode string"
Marc-André Lemburg [Wed, 2 May 2001 14:21:53 +0000 (14:21 +0000)]
Fix for bug #417030: "print '%*s' fails for unicode string"

24 years agoGeneralize filter(f, seq) to work with iterators. This also generalizes
Tim Peters [Wed, 2 May 2001 07:39:38 +0000 (07:39 +0000)]
Generalize filter(f, seq) to work with iterators.  This also generalizes
filter() to no longer insist that len(seq) be defined.
NEEDS DOC CHANGES.

24 years agoPlug a memory leak in list(), when appending to the result list.
Tim Peters [Wed, 2 May 2001 07:12:39 +0000 (07:12 +0000)]
Plug a memory leak in list(), when appending to the result list.

24 years agoWhitespace normalization.
Tim Peters [Wed, 2 May 2001 05:54:44 +0000 (05:54 +0000)]
Whitespace normalization.

24 years agoAdded tests for Weak*Dictionary iterator support.
Fred Drake [Wed, 2 May 2001 05:44:22 +0000 (05:44 +0000)]
Added tests for Weak*Dictionary iterator support.

Refactored some object initialization to be more reusable.

24 years agoAdded iterator support to the Weak*Dictionary classes.
Fred Drake [Wed, 2 May 2001 05:43:09 +0000 (05:43 +0000)]
Added iterator support to the Weak*Dictionary classes.

24 years agoAdd more news about iterators.
Guido van Rossum [Tue, 1 May 2001 20:54:30 +0000 (20:54 +0000)]
Add more news about iterators.

24 years agoGeneralize list(seq) to work with iterators. This also generalizes list()
Tim Peters [Tue, 1 May 2001 20:45:31 +0000 (20:45 +0000)]
Generalize list(seq) to work with iterators.  This also generalizes list()
to no longer insist that len(seq) be defined.
NEEDS DOC CHANGES.
This is meant to be a model for how other functions of this ilk (max,
filter, etc) can be generalized similarly.  Feel encouraged to grab your
favorite and convert it!
Note some cute consequences:
    list(file) == file.readlines() == list(file.xreadlines())
    list(dict) == dict.keys()
    list(dict.iteritems()) = dict.items()
    list(xrange(i, j, k)) == range(i, j, k)

24 years agoDiscard a misleading comment about iter_iternext().
Guido van Rossum [Tue, 1 May 2001 17:01:25 +0000 (17:01 +0000)]
Discard a misleading comment about iter_iternext().

24 years agoPrinting objects to a real file still wasn't done right: if the
Guido van Rossum [Tue, 1 May 2001 16:53:37 +0000 (16:53 +0000)]
Printing objects to a real file still wasn't done right: if the
object's type didn't define tp_print, there were still cases where the
full "print uses str() which falls back to repr()" semantics weren't
honored.  This resulted in

    >>> print None
    <None object at 0x80bd674>
    >>> print type(u'')
    <type object at 0x80c0a80>

Fixed this by always using the appropriate PyObject_Repr() or
PyObject_Str() call, rather than trying to emulate what they would do.

Also simplified PyObject_Str() to always fall back on PyObject_Repr()
when tp_str is not defined (rather than making an extra check for
instances with a __str__ method).  And got rid of the special case for
strings.

24 years agoAdd a proper implementation for the tp_str slot (returning self, of
Guido van Rossum [Tue, 1 May 2001 16:51:53 +0000 (16:51 +0000)]
Add a proper implementation for the tp_str slot (returning self, of
course), so I can get rid of the special case for strings in
PyObject_Str().

24 years agoAdd experimental iterkeys(), itervalues(), iteritems() to dict
Guido van Rossum [Tue, 1 May 2001 12:10:21 +0000 (12:10 +0000)]
Add experimental iterkeys(), itervalues(), iteritems() to dict
objects.

Tests show that iteritems() is 5-10% faster than iterating over the
dict and extracting the value with dict[key].

24 years agoWell darnit! The innocuous fix I made to PyObject_Print() caused
Guido van Rossum [Mon, 30 Apr 2001 14:39:18 +0000 (14:39 +0000)]
Well darnit!  The innocuous fix I made to PyObject_Print() caused
printing of instances not to look for __str__().  Fix this.

24 years agoSF bug #417093: Case sensitive import: dir and .py file w/ same name
Tim Peters [Sun, 29 Apr 2001 22:21:25 +0000 (22:21 +0000)]
SF bug #417093: Case sensitive import: dir and .py file w/ same name
Directory containing
    Spam.py
    spam/__init__.py
Then "import Spam" caused a SystemError, because code checking for
the existence of "Spam/__init__.py" finds it on a case-insensitive
filesystem, but then bails because the directory it finds it in
doesn't match case, and then old code assumed that was still an error
even though it isn't anymore.  Changed the code to just continue
looking in this case (instead of calling it an error).  So
    import Spam
and
    import spam
both work now.

24 years agoFix buglet reported on c.l.py: map(fnc, file.xreadlines()) blows up.
Tim Peters [Sat, 28 Apr 2001 08:20:22 +0000 (08:20 +0000)]
Fix buglet reported on c.l.py:  map(fnc, file.xreadlines()) blows up.
Also a 2.1 bugfix candidate (am I supposed to do something with those?).
Took away map()'s insistence that sequences support __len__, and cleaned
up the convoluted code that made it *look* like it really cared about
__len__ (in fact the old ->len field was only *used* as a flag bit, as
the main loop only looked at its sign bit, setting the field to -1 when
IndexError got raised; renamed the field to ->saw_IndexError instead).

24 years agoA different approach to the problem reported in
Tim Peters [Sat, 28 Apr 2001 05:38:26 +0000 (05:38 +0000)]
A different approach to the problem reported in
Patch #419651: Metrowerks on Mac adds 0x itself
C std says %#x and %#X conversion of 0 do not add the 0x/0X base marker.
Metrowerks apparently does.  Mark Favas reported the same bug under a
Compaq compiler on Tru64 Unix, but no other libc broken in this respect
is known (known to be OK under MSVC and gcc).
So just try the damn thing at runtime and see what the platform does.
Note that we've always had bugs here, but never knew it before because
a relevant test case didn't exist before 2.1.

24 years ago(Adding this to the trunk as well.)
Guido van Rossum [Fri, 27 Apr 2001 21:35:01 +0000 (21:35 +0000)]
(Adding this to the trunk as well.)

Fix a very old flaw in PyObject_Print().  Amazing!  When an object
type defines tp_str but not tp_repr, 'print x' to a real file
object would not call the tp_str slot but rather print a default style
representation: <foo object at 0x....>.  This even though 'print x' to
a file-like-object would correctly call the tp_str slot.

24 years agoGot rid of the whole event filtering mess again, I can't get it to work. Simply disab...
Jack Jansen [Fri, 27 Apr 2001 20:43:27 +0000 (20:43 +0000)]
Got rid of the whole event filtering mess again, I can't get it to work. Simply disabling the Tk event handling hook in _tkinter is not as nice, but at least it works.

24 years agoFix 2.1 nested scopes crash reported by Evan Simpson
Jeremy Hylton [Fri, 27 Apr 2001 02:29:40 +0000 (02:29 +0000)]
Fix 2.1 nested scopes crash reported by Evan Simpson

The new test case demonstrates the bug.  Be more careful in
symtable_resolve_free() to add a var to cells or frees only if it
won't be added under some other rule.

XXX Add new assertion that will catch this bug.

24 years agoimproved error message-- names the type of the unexpected object
Jeremy Hylton [Fri, 27 Apr 2001 02:25:33 +0000 (02:25 +0000)]
improved error message-- names the type of the unexpected object

24 years agoApparently the code to forestall Tk eating events was too aggressive (Tk user input...
Jack Jansen [Thu, 26 Apr 2001 13:22:33 +0000 (13:22 +0000)]
Apparently the code to forestall Tk eating events was too aggressive (Tk user input stopped working). Fixed (I hope:-).

24 years agoAdded more help, and recovery from misspelled sort key arguments.
Eric S. Raymond [Thu, 26 Apr 2001 07:32:38 +0000 (07:32 +0000)]
Added more help, and recovery from misspelled sort key arguments.

24 years agoFiles for 2.1 distribution.
Jack Jansen [Wed, 25 Apr 2001 22:11:24 +0000 (22:11 +0000)]
Files for 2.1 distribution.

24 years agoCheck RefCon backpointer to python object with IsPointerValid() before dereferencing...
Jack Jansen [Wed, 25 Apr 2001 22:09:29 +0000 (22:09 +0000)]
Check RefCon backpointer to python object with IsPointerValid() before dereferencing it (carbon only).

24 years agoUpdated copyright info (which was long due).
Jack Jansen [Wed, 25 Apr 2001 22:08:12 +0000 (22:08 +0000)]
Updated copyright info (which was long due).

24 years ago- Raise console window on input. Fixes Carbon hang.
Jack Jansen [Wed, 25 Apr 2001 22:07:42 +0000 (22:07 +0000)]
- Raise console window on input. Fixes Carbon hang.

24 years ago- Raise console window on input. Fixes Carbon hang.
Jack Jansen [Wed, 25 Apr 2001 22:07:27 +0000 (22:07 +0000)]
- Raise console window on input. Fixes Carbon hang.
- Better handling of menu bar save/restore.
- Override abort() so it honours the "keep console window" flag.

24 years agoDon't crash if InfoScrap doesn't exist (as is the case in Carbon).
Jack Jansen [Wed, 25 Apr 2001 22:05:36 +0000 (22:05 +0000)]
Don't crash if InfoScrap doesn't exist (as is the case in Carbon).

24 years agoCorrect two floating-point representations printed by the interpreter in
Fred Drake [Wed, 25 Apr 2001 21:03:20 +0000 (21:03 +0000)]
Correct two floating-point representations printed by the interpreter in
interactive examples.  Error noted by Dinu Gherman.

24 years agoUpdate test to accomodate the change to the namespace_separator parameter
Fred Drake [Wed, 25 Apr 2001 16:03:54 +0000 (16:03 +0000)]
Update test to accomodate the change to the namespace_separator parameter
of ParserCreate().

Added assignment tests for the ordered_attributes and specified_attributes
values, similar to the checks for the returns_unicode attribute.

24 years agoParserCreate(): Allow an empty string for the namespace_separator argument;
Fred Drake [Wed, 25 Apr 2001 16:01:30 +0000 (16:01 +0000)]
ParserCreate():  Allow an empty string for the namespace_separator argument;
    while not generally a good idea, this is used by RDF users, and works
    to implement RDF-style namespace+localname concatenation as defined
    in the RDF specifications.  (This also corrects a backwards-compatibility
    bug.)

Be more conservative while clearing out handlers; set the slot in the
self->handlers array to NULL before DECREFing the callback.

Still more adjustments to make the code style internally consistent.

24 years agoSF bug 418615: regular expression bug in pipes.py.
Tim Peters [Wed, 25 Apr 2001 03:43:14 +0000 (03:43 +0000)]
SF bug 418615: regular expression bug in pipes.py.
Obviously bad regexps, spotted by Jeffery Collins.

HELP!  I can't run this on Windows, and the module test() function
probably doesn't work on anyone's box.  Could a Unixoid please write
an at least minimal working test and add it to the std test suite?

24 years agoSF bug 418296: WinMain.c should use WIN32_LEAN_AND_MEAN.
Tim Peters [Tue, 24 Apr 2001 05:16:29 +0000 (05:16 +0000)]
SF bug 418296: WinMain.c should use WIN32_LEAN_AND_MEAN.
I believe Kevin Rodgers here!  The old WINDOWS_LEAN_AND_MEAN has, AFAICT,
always been wrong.

24 years agoFix typo in docstring
Andrew M. Kuchling [Mon, 23 Apr 2001 17:13:03 +0000 (17:13 +0000)]
Fix typo in docstring

24 years agoBump version # for final release
Andrew M. Kuchling [Mon, 23 Apr 2001 16:01:06 +0000 (16:01 +0000)]
Bump version # for final release

24 years agoThis patch originated from an idea by Martin v. Loewis who submitted a
Marc-André Lemburg [Mon, 23 Apr 2001 14:44:21 +0000 (14:44 +0000)]
This patch originated from an idea by Martin v. Loewis who submitted a
patch for sharing single character Unicode objects.

Martin's patch had to be reworked in a number of ways to take Unicode
resizing into consideration as well. Here's what the updated patch
implements:

* Single character Unicode strings in the Latin-1 range are shared
  (not only ASCII chars as in Martin's original patch).

* The ASCII and Latin-1 codecs make use of this optimization,
  providing a noticable speedup for single character strings. Most
  Unicode methods can use the optimization as well (by virtue
  of using PyUnicode_FromUnicode()).

* Some code cleanup was done (replacing memcpy with Py_UNICODE_COPY)

* The PyUnicode_Resize() can now also handle the case of resizing
  unicode_empty which previously resulted in an error.

* Modified the internal API _PyUnicode_Resize() and
  the public PyUnicode_Resize() API to handle references to
  shared objects correctly. The _PyUnicode_Resize() signature
  changed due to this.

* Callers of PyUnicode_FromUnicode() may now only modify the Unicode
  object contents of the returned object in case they called the API
  with NULL as content template.

Note that even though this patch passes the regression tests, there
may still be subtle bugs in the sharing code.

24 years agoMondo changes to the iterator stuff, without changing how Python code
Guido van Rossum [Mon, 23 Apr 2001 14:08:49 +0000 (14:08 +0000)]
Mondo changes to the iterator stuff, without changing how Python code
sees it (test_iter.py is unchanged).

- Added a tp_iternext slot, which calls the iterator's next() method;
  this is much faster for built-in iterators over built-in types
  such as lists and dicts, speeding up pybench's ForLoop with about
  25% compared to Python 2.1.  (Now there's a good argument for
  iterators. ;-)

- Renamed the built-in sequence iterator SeqIter, affecting the C API
  functions for it.  (This frees up the PyIter prefix for generic
  iterator operations.)

- Added PyIter_Check(obj), which checks that obj's type has a
  tp_iternext slot and that the proper feature flag is set.

- Added PyIter_Next(obj) which calls the tp_iternext slot.  It has a
  somewhat complex return condition due to the need for speed: when it
  returns NULL, it may not have set an exception condition, meaning
  the iterator is exhausted; when the exception StopIteration is set
  (or a derived exception class), it means the same thing; any other
  exception means some other error occurred.

24 years agoAt the suggestion of Peter Funk, document 'key in dict' and 'key not
Guido van Rossum [Mon, 23 Apr 2001 13:22:59 +0000 (13:22 +0000)]
At the suggestion of Peter Funk, document 'key in dict' and 'key not
in dict' after has_key(), with a \versionadded{2.2} note.

24 years agoUpdate publish-to-SourceForge scripts to automatically determine if the
Fred Drake [Sun, 22 Apr 2001 06:20:31 +0000 (06:20 +0000)]
Update publish-to-SourceForge scripts to automatically determine if the
branch is the head (development) branch or a maintenance brach, and use
the appropriate target directory for each.

24 years agoOnly document <file>.xreadlines() once; added version annotation.
Fred Drake [Sun, 22 Apr 2001 01:56:51 +0000 (01:56 +0000)]
Only document <file>.xreadlines() once; added version annotation.

This closes SF bug #417943.

24 years agoProcess Setup* files with makesetup in the same order as the makefile.
Neil Schemenauer [Sat, 21 Apr 2001 17:41:16 +0000 (17:41 +0000)]
Process Setup* files with makesetup in the same order as the makefile.

24 years agoAdd test suite for iterators.
Guido van Rossum [Sat, 21 Apr 2001 13:33:54 +0000 (13:33 +0000)]
Add test suite for iterators.

24 years agoOops, forgot to merge this from the iter-branch to the trunk.
Guido van Rossum [Sat, 21 Apr 2001 13:20:18 +0000 (13:20 +0000)]
Oops, forgot to merge this from the iter-branch to the trunk.

This adds "for line in file" iteration, as promised.

24 years agoGive UserDict new __contains__ and __iter__ methods.
Tim Peters [Sat, 21 Apr 2001 09:13:15 +0000 (09:13 +0000)]
Give UserDict new __contains__ and __iter__ methods.

24 years agoencode(): Handle Latin-1 input characters better.
Fred Drake [Sat, 21 Apr 2001 06:01:53 +0000 (06:01 +0000)]
encode():  Handle Latin-1 input characters better.

24 years agoAdd support for <memberline/> (needs markup improvement!).
Fred Drake [Sat, 21 Apr 2001 06:00:51 +0000 (06:00 +0000)]
Add support for <memberline/> (needs markup improvement!).

Update <versionadded/> to recent addition of optional explanatory text;
make the explanation text take the same attribute name for both
<versionadded/> and <versionchanged/>.

24 years agoFix a number of minor markup errors.
Fred Drake [Sat, 21 Apr 2001 05:56:06 +0000 (05:56 +0000)]
Fix a number of minor markup errors.

24 years agoThe (fairly recent) \textasciicircum is not supported by LaTeX2HTML; add
Fred Drake [Sat, 21 Apr 2001 05:48:07 +0000 (05:48 +0000)]
The (fairly recent) \textasciicircum is not supported by LaTeX2HTML; add
support for it here.

24 years agoSF bug #417508: 'hypot' not found with Borland C++Build.
Tim Peters [Sat, 21 Apr 2001 03:20:47 +0000 (03:20 +0000)]
SF bug #417508: 'hypot' not found with Borland C++Build.

24 years agoSF but #417587: compiler warnings compiling 2.1.
Tim Peters [Sat, 21 Apr 2001 02:46:11 +0000 (02:46 +0000)]
SF but #417587: compiler warnings compiling 2.1.
Repaired *some* of the SGI compiler warnings Sjoerd Mullender reported.

24 years agoTeach Windows about new iterobject.c.
Tim Peters [Fri, 20 Apr 2001 21:21:28 +0000 (21:21 +0000)]
Teach Windows about new iterobject.c.

24 years agoAdding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum [Fri, 20 Apr 2001 21:06:46 +0000 (21:06 +0000)]
Adding iterobject.[ch], which were accidentally not added.  Sorry\!

24 years agoIterators phase 1. This comprises:
Guido van Rossum [Fri, 20 Apr 2001 19:13:02 +0000 (19:13 +0000)]
Iterators phase 1.  This comprises:

new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER
new C API PyObject_GetIter(), calls tp_iter
new builtin iter(), with two forms: iter(obj), and iter(function, sentinel)
new internal object types iterobject and calliterobject
new exception StopIteration
new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py)
new magic number for .pyc files
new special method for instances: __iter__() returns an iterator
iteration over dictionaries: "for x in dict" iterates over the keys
iteration over files: "for x in file" iterates over lines

TODO:

documentation
test suite
decide whether to use a different way to spell iter(function, sentinal)
decide whether "for key in dict" is a good idea
use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?)
speed tuning (make next() a slot tp_next???)

24 years agodispatcher.__repr__() was unprepared to handle the address for a Unix
Jeremy Hylton [Fri, 20 Apr 2001 19:04:55 +0000 (19:04 +0000)]
dispatcher.__repr__() was unprepared to handle the address for a Unix
domain socket.  Fix that and make the error message for failures a
little more helpful by including the class name.

24 years agoOops. Removed dictiter_new decl that wasn't supposed to go in yet.
Guido van Rossum [Fri, 20 Apr 2001 16:52:06 +0000 (16:52 +0000)]
Oops.  Removed dictiter_new decl that wasn't supposed to go in yet.

24 years agoImplement, test and document "key in dict" and "key not in dict".
Guido van Rossum [Fri, 20 Apr 2001 16:50:40 +0000 (16:50 +0000)]
Implement, test and document "key in dict" and "key not in dict".

I know some people don't like this -- if it's really controversial,
I'll take it out again.  (If it's only Alex Martelli who doesn't like
it, that doesn't count as "real controversial" though. :-)

That's why this is a separate checkin from the iterators stuff I'm
about to check in next.

24 years agoCVS patch 416248: 2.1c1 unicodeobject: unused vrbl cleanup, from Mark Favas.
Tim Peters [Thu, 19 Apr 2001 21:55:14 +0000 (21:55 +0000)]
CVS patch 416248: 2.1c1 unicodeobject: unused vrbl cleanup, from Mark Favas.

24 years agoRevert previous checkin, which caused test_unicodedata to fail.
Jeremy Hylton [Thu, 19 Apr 2001 16:43:49 +0000 (16:43 +0000)]
Revert previous checkin, which caused test_unicodedata to fail.

24 years agoWeak*Dictionary: Added docstrings to the classes.
Fred Drake [Thu, 19 Apr 2001 16:26:06 +0000 (16:26 +0000)]
Weak*Dictionary:  Added docstrings to the classes.

Weak*Dictionary.update():  No longer create a temporary list to hold the
    things that will be stuffed into the underlying dictionary.  This had
    been done so that if any of the objects used as the weakly-held value
    was not weakly-referencable, no updates would take place (TypeError
    would be raised).  With this change, TypeError will still be raised
    but a partial update could occur.  This is more like other .update()
    implementations.

Thoughout, use of the name "ref" as a local variable has been removed.  The
original use of the name occurred when the function to create a weak
reference was called "new"; the overloaded use of the name could be
confusing for someone reading the code.  "ref" used as a variable name
has been replaced with "wr" (for 'weak reference').

24 years agoAdd versioning notes: many of the signatures changed to allow the time
Fred Drake [Thu, 19 Apr 2001 04:55:23 +0000 (04:55 +0000)]
Add versioning notes:  many of the signatures changed to allow the time
used to be omitted (meaning use the current time) as of Python 2.1.
Users who need cross-version portability need to know things like this.

24 years agoMove Windows stuff to 2.2, so CVS builds won't interfere with 2.1
Tim Peters [Wed, 18 Apr 2001 21:12:25 +0000 (21:12 +0000)]
Move Windows stuff to 2.2, so CVS builds won't interfere with 2.1
installations.

24 years agoCut-&-paste-o noted by Wolfgang Teschner: decompressobj() returns
Fred Drake [Wed, 18 Apr 2001 20:16:51 +0000 (20:16 +0000)]
Cut-&-paste-o noted by Wolfgang Teschner:  decompressobj() returns
*DE*compression objects, not compression objects!

24 years agoRemove BrowserControl module; this had been left in for Python 1.5.2
Fred Drake [Wed, 18 Apr 2001 18:43:34 +0000 (18:43 +0000)]
Remove BrowserControl module; this had been left in for Python 1.5.2
support.

24 years agoRemove legacy support for the BrowserControl module; the webbrowser
Fred Drake [Wed, 18 Apr 2001 18:42:48 +0000 (18:42 +0000)]
Remove legacy support for the BrowserControl module; the webbrowser
module has been included since Python 2.0, and that is the preferred
interface.

24 years agoSuggestion from Keith Briggs: refer to RE objects consistently instead of
Fred Drake [Wed, 18 Apr 2001 17:26:20 +0000 (17:26 +0000)]
Suggestion from Keith Briggs:  refer to RE objects consistently instead of
introducing a new term ("regex") without defining it.

24 years agoPatch #416953: Cache ASCII characters to speed up ASCII decoding.
Martin v. Löwis [Wed, 18 Apr 2001 12:49:15 +0000 (12:49 +0000)]
Patch #416953: Cache ASCII characters to speed up ASCII decoding.

24 years agoSync version number with the current CVS version.
Fred Drake [Wed, 18 Apr 2001 05:22:24 +0000 (05:22 +0000)]
Sync version number with the current CVS version.

(Note that the docs are also being maintained on the 2.1.1 maintenance
 branch, so users interested only in corrections and clarifications
 can get that.)

24 years agoAdd description of the "explanation" optional parameter added to the
Fred Drake [Wed, 18 Apr 2001 05:19:06 +0000 (05:19 +0000)]
Add description of the "explanation" optional parameter added to the
\versionadded macro.

Note: this should not be merged into the 2.1 maintenance branch.

24 years agoMake a number of small clarifications and correct a whole bunch of typos,
Fred Drake [Wed, 18 Apr 2001 05:12:47 +0000 (05:12 +0000)]
Make a number of small clarifications and correct a whole bunch of typos,
all reported by Bruce Smith.

24 years agoSync version number with the current CVS version.
Fred Drake [Wed, 18 Apr 2001 05:02:01 +0000 (05:02 +0000)]
Sync version number with the current CVS version.

(Note that the docs are also being maintained on the 2.1.1 maintenance
 branch, so users interested only in corrections and clarifications
 can get that.)

24 years agoBump the version number in more places
Guido van Rossum [Wed, 18 Apr 2001 04:37:57 +0000 (04:37 +0000)]
Bump the version number in more places

24 years agoChange the version to 2.2a0. This may look strange, but indicates
Guido van Rossum [Wed, 18 Apr 2001 04:31:01 +0000 (04:31 +0000)]
Change the version to 2.2a0.  This may look strange, but indicates
it's 2.2 before the first alpha release.

24 years agoupdate_yourself(): Removed unused local variable reported by
Barry Warsaw [Wed, 18 Apr 2001 03:53:29 +0000 (03:53 +0000)]
update_yourself(): Removed unused local variable reported by
PyChecker.

24 years ago__init__(): Removed unused local variable reported by PyChecker.
Barry Warsaw [Wed, 18 Apr 2001 03:52:54 +0000 (03:52 +0000)]
__init__(): Removed unused local variable reported by PyChecker.

24 years agoStripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw [Wed, 18 Apr 2001 03:51:55 +0000 (03:51 +0000)]
StripWidget.__init__(), update_yourself(): Removed some unused local
variables reported by PyChecker.

__togglegentype(): PyChecker accurately reported that the variable
__gentypevar was unused -- actually this whole method is currently
unused so comment it out.

24 years agoHelpwin.__init__(): Removed an unused local variable (via import)
Barry Warsaw [Wed, 18 Apr 2001 03:50:07 +0000 (03:50 +0000)]
Helpwin.__init__(): Removed an unused local variable (via import)
reported by PyChecker.

24 years agoBump the version to 1.1
Barry Warsaw [Wed, 18 Apr 2001 03:49:00 +0000 (03:49 +0000)]
Bump the version to 1.1

24 years agoThere have been a few new Python releases <wink> in the 2 years since
Barry Warsaw [Wed, 18 Apr 2001 03:48:41 +0000 (03:48 +0000)]
There have been a few new Python releases <wink> in the 2 years since
this tool was last touched!  Update some of the introductory material
and bump the version to 1.1.