Re: Two python issues

2024-11-06 Thread Piergiorgio Sartor via Python-list
On 05/11/2024 15.48, Raymond Boute wrote: L.S., Python seem to suffer from a few poor design decisions regarding strings and lists that affect the elegance of the language. (a) An error-prone "feature" is returning -1 if a substring is not found by "find", since -1 currently refers to the la

Re: Two python issues

2024-11-06 Thread Roel Schroeven via Python-list
Op 5/11/2024 om 15:48 schreef Raymond Boute via Python-list: L.S., Python seem to suffer from a few poor design decisions regarding strings and lists that affect the elegance of the language. (a) An error-prone "feature" is returning -1 if a substring is not found by "find", since -1 current

Re: Two python issues

2024-11-05 Thread dn via Python-list
On 6/11/24 10:08, Jason Friedman via Python-list wrote: (a) An error-prone "feature" is returning -1 if a substring is not found by "find", since -1 currently refers to the last item. An example: >>> s = 'qwertyuiop' >>> s[s.find('r')] 'r' >>> s[s.find('p')] 'p' >>> s[s.find('a')] 'p'

Re: Two python issues

2024-11-05 Thread Jason Friedman via Python-list
> > (a) An error-prone "feature" is returning -1 if a substring is not found > by "find", since -1 currently refers to the last item. An example: > > >>> s = 'qwertyuiop' > >>> s[s.find('r')] > 'r' > >>> s[s.find('p')] > 'p' > >>> s[s.find('a')] > 'p' > >>> > > If "find" is unsuccessful, an er

Re: Two python issues

2024-11-05 Thread Cameron Simpson via Python-list
On 05Nov2024 15:48, Raymond Boute wrote: Python seem to suffer from a few poor design decisions regarding strings and lists that affect the elegance of the language. (a) An error-prone "feature" is returning -1 if a substring is not found by "find", since -1 currently refers to the last item.

Two python issues

2024-11-05 Thread Raymond Boute via Python-list
L.S., Python seem to suffer from a few poor design decisions regarding strings and lists that affect the elegance of the language. (a) An error-prone "feature" is returning -1 if a substring is not found by "find", since -1 currently refers to the last item. An example: >>> s = 'qwertyuiop'