Why does Python show the whole array?

John Machin sjmachin at lexicon.net
Thu Apr 9 10:15:30 CEST 2009


On Apr 9, 4:53 pm, Lawrence D'Oliveiro <l... at geek-
central.gen.new_zealand> wrote:
> In message <o0tot492cfjj2g180p15irievp6crpc... at 4ax.com>, Gilles Ganault
> wrote:
>
> > test = "t... at gmail.com"
> > isp = ["gmail.com", "yahoo.com"]
> > for item in isp:
> > if test.find(item):
> > print item
> > ======= output
> > gmail.com
> > yahoo.com
> > =======
>
> This is why conditional constructs should not accept any values other than
> True and False.

An alternative viewpoint: This is what happens when one user doesn't
understand a long-standing idiom and/or doesn't read the manual.
That's all. It doesn't constitute evidence that such a restriction
would be generally beneficial.



More information about the Python-list mailing list