On 13 July 2013 22:25, Dave Angel <da...@davea.name> wrote:

try:
>     input = raw_input
> except NameError as e:
>     pass
>
> try:
>     range = xrange
> except NameError as e:
>     pass
>
> ======
Couldn't I just shorten that to:

if int(sys.version[0]) < 3:
    try:
        input = raw_input
        range = xrange
    except NameError as err:
        pass

Since it's the same error in both cases, and I only pass in either case, so
the logic looks the same to me? Or am I missing something?

---
Jim

Wash your fruits and veggies, folks. Contrary to the popular delusion of
yuppies, the giant farm corporations that hire fruit pickers do not provide
outhouses, washing facilities, or the time to use them, anyway. The apple
you bit into may be one step from a bumwipe. And no, the markets don't wash
things either. They only  water-spray them now and then to make them look
fresher.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to