[Tutor] iterators
Steven D'Aprano
steve at pearwood.info
Mon Jul 4 20:42:06 EDT 2016
On Tue, Jul 05, 2016 at 12:47:27AM +0100, Alan Gauld via Tutor wrote:
> > I then tried using
> >
> > elif keycode == 27:
> >
> > but this statement didn't work.
>
> I'm not sure why that didn't work.
> What exactly happened? Did you get a different error message?
> If so what?
I expect that the keycode is always a tuple, usually with two items but
sometimes with one. So keycode == 27 compares the tuple (27,) with the
int 27 and finds them to be different.
--
Steve
More information about the Tutor
mailing list