Proposal to Add New Method to List Object: Mutable Sequence Types

VenkataRamaKrishna Boddu bvrkchowdary at yahoo.co.in
Wed May 13 04:55:51 EDT 2009


Hi All,

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);

Thanks
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...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090513/b560a9d9/attachment.html>


More information about the Python-list mailing list