Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6385
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | Mel <mwilson@the-wire.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: bug in str.startswith() and str.endswith() |
| Followup-To | comp.lang.python |
| Date | Fri, 27 May 2011 09:03:55 -0400 |
| Organization | Aioe.org NNTP Server |
| Lines | 21 |
| Message-ID | <iro7fs$9ep$1@speranza.aioe.org> (permalink) |
| References | <4DDEE1C8.6010107@stoneleaf.us> <mailman.2141.1306465246.9059.python-list@python.org> |
| Reply-To | mwilson@the-wire.com |
| NNTP-Posting-Host | V7j4zcmtGzEmG1C7HjXFbg.user.speranza.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | KNode/4.4.8 |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:6385 |
Followups directed to: comp.lang.python
Show key headers only | View raw
Terry Reedy wrote:
> To me, that says pretty clearly that start and end have to be
> 'positions', ie, ints or other index types. So I would say that the
> error message is a bug. I see so reason why one would want to use None
> rather that 0 for start or None rather than nothing for end.
If you're trying to wrap a call to startswith in a function that "looks
like" startswith, there's no easy way to pass in the information that your
caller wants the default parameters. The case I ran into was
def wrapped_range (start, stop=None, span=None):
do_some_things()
result = range (start, stop, span) # range doesn't(/didn't) accept this
return result
Tne answer in that case was to take *args as the parameter to wrapped_range
and count arguments to distinguish between the different calls to range.
Mel.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: bug in str.startswith() and str.endswith() Terry Reedy <tjreedy@udel.edu> - 2011-05-26 23:00 -0400 Re: bug in str.startswith() and str.endswith() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-27 03:27 +0000 Re: bug in str.startswith() and str.endswith() Mel <mwilson@the-wire.com> - 2011-05-27 09:03 -0400
csiph-web