Hey all,

Apologies if this is the wrong list to post to -- I couldn't find a
cython-users list...

I've been using Cython to speed up instantiation of a Namespace object
written in Python: http://paste.lisp.org/display/69989

Fundamentally, what I am trying to do is:

class Namespace:
  def __init__(self, **env):
    global id, store
    id += 1
    keys = store[id] = sorted(env)
    new_env = []
    for key in keys:
        obj = env[key]
        if PyFunction_Check(obj):
            obj = staticmethod(obj)
        new_env.append(obj)
    self.env = new_env

The sort() and looping (for key in keys) seems to take up most of the
time... how can I do this better so that it takes less time?

The Cython version so far is at http://paste.lisp.org/display/69988

Please forgive my Cython newbie errors... Thanks!

-- 
love, tav

plex:espians/tav | [EMAIL PROTECTED] | +44 (0) 7809 569 369
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to