Excerpts from Bram Moolenaar's message of Fri May 31 20:49:45 +0200 2013:
> Then :pyx would really work.  Is that possible without getting errors
> for some code that works only in one versin?

Example taken from UltiSnips:
  ./py-code/UltiSnips/compatibility.py
  ./py-code/UltiSnips/compatibility_py2.py
  ./py-code/UltiSnips/compatibility_py3.py

Everything else is shared.

Of course 

if py2:
  print "foo"
else:
  print("foo")


will not work, but stdout.write("foo\n") would work for both.
Also you could move the code into modules:

if py 2:
  import py2
else:
  import py3

There are also some module which can be loaded improving compatibility:
http://pythonhosted.org/six/

However I never used such.

Marc Weber

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to