Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80250

Python, VIM: namespace, scope, life of a python object stuck in a << HERE

From Veek M <vek.m1234@gmail.com>
Newsgroups comp.lang.python
Subject Python, VIM: namespace, scope, life of a python object stuck in a << HERE
Followup-To comp.lang.python
Date 2014-11-05 12:28 +0630
Organization Home
Message-ID <m3chpj$7qk$1@dont-email.me> (permalink)

Followups directed to: comp.lang.python

Show all headers | View raw


If i have two functions:

function! foo()
python3 << HERE
 import mylib
 pass
HERE

function! bar()
python3 << HERE
 import mylib
 pass
HERE

The src says:

 1. Python interpreter main program
 3. Implementation of the Vim module for Python

So, is the python interpreter embedded in vim AND additionally, are separate 
extensions to python provided (wrapper functions for the VIM API). Mixed 
bindings?

How many times is mylib compiled to bytecode and loaded? Does each vimscript 
function get its own mylib - can I instantiate something and expect it to be 
visible in the other function? I have a bunch of leader (\)-functions that 
share similar code and act on the same buffer so I wanted to know if I could 
reuse that data-structure. How many times is the interpreter loaded into 
memory: once obviously at vim runtime.

Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Python, VIM: namespace, scope, life of a python object stuck in a << HERE Veek M <vek.m1234@gmail.com> - 2014-11-05 12:28 +0630
  Re: Python, VIM: namespace, scope, life of a python object stuck in a << HERE Peter Otten <__peter__@web.de> - 2014-11-05 08:44 +0100

csiph-web