cbysnoopy / python-on-a-chip

Automatically exported from code.google.com/p/python-on-a-chip
0 stars 0 forks source link

Add filter() function to builtins #59

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Python 2.6 includes the function {{{filter()}}} in its set of builtins.  It 
would be advantageous to add this function to the VM's builtins.

Original issue reported on code.google.com by dwhall...@gmail.com on 8 Jan 2010 at 4:14

GoogleCodeExporter commented 9 years ago
Suggested implementation:

def filter(f, s):
    return [x for x in s if f(x)]

Original comment by dwhall...@gmail.com on 8 Jan 2010 at 4:15

GoogleCodeExporter commented 9 years ago
Discovered a bug along the way: if f is not a function, CALL_FUNCTION fails due 
to a 
PM_RET_ASSERT_FAIL.  The proper failure would be to throw a TypeError.  Code 
changed to 
make this happen.

Original comment by dwhall...@gmail.com on 10 Jan 2010 at 4:55

GoogleCodeExporter commented 9 years ago

Original comment by dwhall...@gmail.com on 10 Jan 2010 at 4:55

GoogleCodeExporter commented 9 years ago
Added system test t259.  Running system test reveals that RAM is low, created 
Issue #63 
to resolve low RAM.

Original comment by dwhall...@gmail.com on 10 Jan 2010 at 5:47

GoogleCodeExporter commented 9 years ago
After resolving issue #63, system tests pass.  Filter works on ipm, too.  Also, 
two t259 cases that throw TypeError on purpose did so.

Mainlined directly, see r408

Original comment by dwhall...@gmail.com on 17 Jan 2010 at 8:09

GoogleCodeExporter commented 9 years ago
Changing Milestone-r10 to Milestone-r09

Original comment by dwhall...@gmail.com on 7 Mar 2010 at 6:26

GoogleCodeExporter commented 9 years ago
Changed r09 to R09

Original comment by dwhall...@gmail.com on 12 Mar 2010 at 8:22

GoogleCodeExporter commented 9 years ago

Original comment by dwhall...@gmail.com on 13 Mar 2010 at 1:30