Proposal to Add New Method to List Object: Mutable Sequence Types
bvrkchowdary at yahoo.co.in
Wed May 13 10:55:51 CEST 2009
This is my first mail to python-list.
I just want to propose the idea of introducing a new method for the List Object in similar lines of Dictionary Object has_key method.
See my below code, It always produces the ValueError, if I want to check whether an item is present or not, then they is no method in the List Object (do a "dir(list)").
So., Is it not good, to have a method in List Object, may be something like has_item to check whether a item is present or not?
#============== CODE ==============================
partsOfMyName = ['Python', 'Perl', 'PHP', 'MySQL'];
## strSearchKey = 'Perl';
strSearchKey = 'Prl';
indexofKey = partsOfMyName.index(strSearchKey);
print 'Index of search key: %s: %d'%(strSearchKey, indexofKey);
Venkata Rama Krishna Boddu
Explore and discover exciting holidays and getaways with Yahoo! India Travel http://in.travel.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list