On Aug 12, 4:23 am, winterTTr <[email protected]> wrote:
>
> OK, thanks so much for your answers.  I do not notice the get() method.
> There is indeed an alternate way to do so. That's great.
>
> However, I must use this code everywhere if i want the feature as i mentioned.
> Even the other person who want to use my code should do the same thing.
> This is not a elegant way, right?
>
> I just want to figure out whether we can hack the dictionary object
> to give it the __index__ feature at the "script" level?

How about adding a function to the dictionary called myGet() or
something like that. Although you CAN access the elements like
mydict.index or mydict['index'], instead you would use (and encourage
other users of your script to use) mydict.myGet('index'). Under normal
circumstances myGet would just return self[a:index].

-- 
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

Raspunde prin e-mail lui