[ python-Bugs-1546585 ] String methods don't support explicit None arguments

SourceForge.net noreply at sourceforge.net
Fri Aug 25 14:04:21 CEST 2006


Bugs item #1546585, was opened at 2006-08-25 21:39
Message generated for change (Settings changed) made by ncoghlan
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1546585&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
>Resolution: Later
Priority: 7
Submitted By: Nick Coghlan (ncoghlan)
Assigned to: Nobody/Anonymous (nobody)
Summary: String methods don't support explicit None arguments

Initial Comment:
Unlike normal slicing, string methods do not currently
support passing an explicit None argument (you either
have to omit the arguments, or pass an actual integer
or object with an __index__ method).

This was the case in previous Python versions, so no
existing code is going to break.

However these methods issue the same TypeError message
as normal slicing which now explicitly lists None as an
acceptable value, which is confusing as all heck when
the call that breaks is "s.index(sub, start, stop)"m
and printing out start and stop shows them both to be None.

Given that the string docs say things like (from
str.count) "Optional arguments start and end are
interpreted as in slice notation", I think this should
be fixed (which is why I put it on the bug tracker for
2.5, not the RFE one for 2.6).

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

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


More information about the Python-bugs-list mailing list