[Tutor] What's the logic behind parameters and arguments?
Rafael Durán Castañeda
rafadurancastaneda at gmail.com
Tue Mar 29 11:24:58 CEST 2011
I don't see discrepancy, end and count are two arguments than mean very
different things. End is the position where find ends, it could be included
or excluded, in this case is excluded. Count is the maximun number of
substrings you want to replace, it wouldn't make sense count=6 if you want
to replace 5.
2011/3/29 David <ldl08 at gmx.net>
> Dear list readers,
> the command find() takes two parameters, start and end, e.g.:
> find(substring[, start[, end]]).
> Here, a substring is located UP TO BUT NOT INCLUDING the optional
> parameter 'end'.
> Compare this to replace(). replace() comes with the count argument, e.g.:
> replace(old, new[, count])
> But here the substring is replaced UP TO AND INCLUDING to the optional
> argument count.
> My question is how I am best to make sense of this discrepancy. Is there
> any logic behind this that might make my life easier once I become aware
> of it? I know of the indexing rules, but this here is obviously not the
> same. I am curious...
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor