rbrewer123 / pycsp

Automatically exported from code.google.com/p/pycsp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The identity decorator choice() could be simpler

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?

View one of the definitions of choice(). 
http://code.google.com/p/pycsp/source/browse/trunk/pycsp/greenlets/alternation.p
y#19

Given it's a decorator that does nothing, wouldn't it be better to have just

    def choice(func):
        return func

instead of creating the closure and _call()?  It would save the overhead of
the extra call at run time, plus the space used.

Note, there's several definitions of choice() around the place so this
change could be made to all the ones that are effectively "identity".

Original issue reported on code.google.com by ralph.co...@gmail.com on 13 Jun 2009 at 12:29

You are definitely right.

Soon we will provide a choice decorator, which is not just the "identify" 
function.

Original comment by runedren...@gmail.com on 17 Aug 2009 at 12:39

  • Changed state: WontFix