Why does Python show the whole array?
sjmachin at lexicon.net
Thu Apr 9 16:46:52 CEST 2009
On Apr 10, 12:35 am, John Posner <jjpos... at snet.net> wrote:
> Lawrence D'Oliveiro wrote:
> > Fine if it only happened once. But it's a commonly-made mistake. At some
> > point you have to conclude that not all those people are stupid, there
> > really is something wrong with the design.
> I think "something wrong with the design" is overstating the case a bit,
> and is likely to elicit some negative reactions in this forum. But I
> agree with your point, to this extent: this situation illustrates the
> way in which Python "overloads" the number zero:
> Realm A: "0" indicates the first position in a sequence
> Realm B: "0" indicates the Boolean value "False"
> You just need to remember that the find() function works in Realm A, and
> the "in" operator works in Realm B.
> Q: Has anyone on the python-dev list ever proposed a "string"-module
> function that does the job of the "in" operator? Maybe this:
> if test.contains(item) # would return a Boolean value
command_prompt> \python23\python -c "print 'frobozz'.__contains_
Was first introduced in Python 2.2, with only a single character
allowed in the arg.
More information about the Python-list