[Python-bugs-list] [ python-Bugs-801349 ] New slice behaviour. Bug or feature?

SourceForge.net noreply at sourceforge.net
Fri Sep 5 19:31:26 EDT 2003


Bugs item #801349, was opened at 2003-09-05 16:28
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=801349&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: logistix (logistix)
>Assigned to: Michael Hudson (mwh)
Summary: New slice behaviour.  Bug or feature?

Initial Comment:
Using a slice of x[:None] returns the whole list.  I would 

thing that if this sort of statement is valid, it should 

return an empty list, like x[:0].  In 2.2, you'll get an 

error with this statement.



This bit me when I was using None as a sentinel.



I'll be able to write a patch when I find out what the 

desired behaviour is (fine as-is, None should behave as 

0, it should throw an error, or other) assuming sf's cvs is 

playing nice.





Microsoft Windows XP [Version 5.1.2600]

(C) Copyright 1985-2001 Microsoft Corp.



C:\Documents and Settings\grant>c:\python23\python

Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 

32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more 

information.

>>> a = [1,2,3,4]

>>> a[:None]

[1, 2, 3, 4]

>>> ^Z





C:\Documents and Settings\grant>c:\python22\python

'import site' failed; use -v for traceback

Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit 

(Intel)] on win32

Type "help", "copyright", "credits" or "license" for more 

information.

>>> a = [1,2,3,4]

>>> a[:None]

Traceback (most recent call last):

  File "<stdin>", line 1, in ?

TypeError: sequence index must be integer

>>> ^Z





C:\Documents and Settings\grant>

----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2003-09-05 21:31

Message:
Logged In: YES 
user_id=33168

Michael, do you think happened with your extended slice changes?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=801349&group_id=5470



More information about the Python-bugs-list mailing list