Pavol Lisy <pavol.l...@gmail.com>:

> On 7/7/17, Steve D'Aprano <steve+pyt...@pearwood.info> wrote:
>
>> import sys
>> if sys.version_info >= (3,):  # the comma is important
>>     print("version 3")
>
> But be careful inside script! It could live long enough to see python4
> :)

That's a serious concern. An application doesn't know about Python's
future. What would be needed is:

   import sys
   try:
       sys.require_version((3, 4, 2))
   except NotSupportedException:
       sys.stderr.write("Sorry :(\n")
       sys.exit(1)


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to