[Patches] Multiply sequences by longs

Guido van Rossum guido@python.org
Mon, 14 Feb 2000 16:36:29 -0500


> This patch makes 5L * 'b' legal; with the large-file patches, some
> people have run into bugs in modules such as dumbdbm that don't expect
> f.tell() to return a long int..

Andrew, go ahead and check this in yourself.

> One inconsistency: 1231231232312341414L * 'a' gets an
> OverflowError (long int too long to convert), while 312341414L * 'a'
> raises a MemoryError.  I think this wouldn't be a problem in practice.

No problem.

> Documentation: a patch to the Reference and LibRef are required; there
> may be other bits of the docs that need changing.  If this gets
> accepted, I'll make patches for the docs.

Please go ahead -- you can check them in directly (unless Fred
disagrees :-).

> Question: should other bits of the core be changed to accept long
> ints?  Slicing, for instance, as in mylist[ 0L:5L ]?  (python-dev
> topic, maybe?)

Yes, that's been a longstanding desire.  I think it's okay to do this
one case at a time.  Note that even before slicing comes indexing!

There are other, similar wishes: accept all sequences rather than just
tuples or just lists, in many places.

Also, we could be more generous in accepting mappings rather than just
requiring dictionaries.  However, there are some problems with this.
There's an old patch that I never applied for various reasons; look
for Ian Castleden in http://www.python.org/~guido/patch/.

--Guido van Rossum (home page: http://www.python.org/~guido/)