Hi all!

I sometimes put (per a hint I found on a web search) code like that at the
beginning of my Python programs:

if sys.version_info > (3,):
    long = int
    xrange = range

(e.g:
https://github.com/shlomif/project-euler/blob/master/project-euler/581/euler_581_v3.py#L4
)

This is a py2/py3 compatibility shim.

My question is whether I should put it only at the main program's file or also
at each and every *.py module that I load? I'm not sure I understand the python
handling of symbols well enough to answer that.

Thanks and happy holidays!

        Shlomi Fish
_______________________________________________
Python-il mailing list
[email protected]
http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il

לענות