Why does Python show the whole array?
John Posner
jjposner at snet.net
Thu Apr 9 15:21:52 EDT 2009
> Peter Otten wrote:
>> Could you explain why you prefer 'contains(belly, beer)'
>> or 'belly.contains(beer)' over 'beer in belly'? The last form may be
a bit
>> harder to find in the documentation, but once a newbie has learned about
>> it he'll find it easy to remember.
andrew cooke wrote:
> i don't know why i get involved in this type of discussion, but....
====
I sense growing exasperation, and I do *not* have strong feelings on
this matter, so I promise this will be my last message on this topic.
I don't really prefer 'contains(belly, beer)' over 'beer in belly'.
Rather, it's a completeness/consistency argument: a language that
includes these methods for string objects:
belly.startswith(arg)
belly.endswith(arg)
... should also include:
belly.contains(arg)
The lack of this method increases the likelihood that a user will
mistakenly use the find() method as a predicate.
More information about the Python-list
mailing list