On 07/14/2013 01:02 AM, Jim Mooney wrote:
On 13 July 2013 21:41, eryksun <eryk...@gmail.com> wrote:
A lot of new packages support versions 2.6+, which have the "with"
statement enabled.
So, since I'm using 2.7 I don't need generators or with?
Then all I'm using to be 3.3ish, would be:
from __future__ import division, print_function
import sys
if int(sys.version_info[0]) < 3:
input = raw_input
range = xrange
Any time you can avoid making specific version # checks, you're better
off. When I was dealing with Microsoft version changes, I frequently
ran into problems where one piece of code would lie about versions just
to fool certain libraries into compensating, and the resulting mess was
a morass of bugs waiting to pop. Remember when Windows 4.0 had an
internal version of 3.99, so that some obscure package would still be
willing to work?
try:
input = raw_input
except NameError as e:
pass
try:
range = xrange
except NameError as e:
pass
for my header macro. I'll try to remember about Tkinter.
Anything else missing of great import ;') I don't want that to get too big
- just the minimum.
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
--
DaveA
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor