1

I'm a bit confused as to what the difference is between python and pyx in vim, other than one seems to work and the other does not. For example:

pyx print ("OK")

This works, however, this does not:

python << EOF
    print 'OK'
EOF

And this does not:

:python print "Hello"

E319: Sorry, the command is not available in this version

What is the difference between the two? :h python is quite extensive, but every single command it gives does not work with the above command (though pyx does work).

Is pyx is the proper alias for python now?

pyx << END_OF_PYTHON

  import uuid
  my_id = (uuid.uuid4())
  vim.command("let my_id='%s'" % my_id)

END_OF_PYTHON

echom "The UUID4 is: " .my_id

" The UUID4 is: 1c131603-1b3f-4eb4-b8c8-ec600dc78628
2

All the py*x functions and commands permits to dynamically change which flavour of python is used -- through a global option.

python means python2. python3 means ... v 3. And unfortunately once one has been successfully used, or even tested :(, the other one can no longer be used. IIRC, This also impacts which flavour of python py*x can target.

IMO, we should no longer use python or python3 unless our code cannot work with the other python flavour. With py*x we can have portable code.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.