[Tutor] A slight bug in IDLE

Jim Mooney cybervigilante at gmail.com
Sun Jul 14 21:28:30 CEST 2013


On 13 July 2013 22:25, Dave Angel <davea at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130714/39ff2461/attachment.html>


More information about the Tutor mailing list