K
Kepes Krisztian
Hi !
A.)
The string object have a method named "index", and have a method named
"find".
It is good, because many times we need to find anything, and it is
very long to write this:
try:
i=s.index('a')
except:
i=-1
if i<>-1: pass
and not this:
if (s.find('a')<>-1): pass
Why don't exists same method in the list object ?
It is very ugly thing (sorry, but I must say that).
I must write in every times:
l=[1,2,3,4]
try:
i=l.index(5)
except:
i=-1
if i<>-1: pass
and not this:
if (l.find(5)<>-1): pass
B.)
Same thing is the deleting.
I think, this method is missing from strings, and lists.
Example:
I must write this:
s='abcdef'
l=[1,2,5,3,4,5]
print s
s=s[:2]+s[3:]
print s
print l
l[2]=None
l.remove(None)
print l
and not this:
s='abcdef'
l=[1,2,5,3,4,5]
s=s.delete(2)
l.delete(2)
So: some functions/methods are neeeded to Python-like programming
(less write, more effectivity).
KK
A.)
The string object have a method named "index", and have a method named
"find".
It is good, because many times we need to find anything, and it is
very long to write this:
try:
i=s.index('a')
except:
i=-1
if i<>-1: pass
and not this:
if (s.find('a')<>-1): pass
Why don't exists same method in the list object ?
It is very ugly thing (sorry, but I must say that).
I must write in every times:
l=[1,2,3,4]
try:
i=l.index(5)
except:
i=-1
if i<>-1: pass
and not this:
if (l.find(5)<>-1): pass
B.)
Same thing is the deleting.
I think, this method is missing from strings, and lists.
Example:
I must write this:
s='abcdef'
l=[1,2,5,3,4,5]
print s
s=s[:2]+s[3:]
print s
print l
l[2]=None
l.remove(None)
print l
and not this:
s='abcdef'
l=[1,2,5,3,4,5]
s=s.delete(2)
l.delete(2)
So: some functions/methods are neeeded to Python-like programming
(less write, more effectivity).
KK