{"id":56,"date":"2008-01-16T11:14:04","date_gmt":"2008-01-16T17:14:04","guid":{"rendered":"http:\/\/www.philhassey.com\/blog\/2008\/01\/16\/64k-tinypy-now-with-list-comprehensions-and-fancy-arguments\/"},"modified":"2008-02-19T01:13:49","modified_gmt":"2008-02-19T07:13:49","slug":"64k-tinypy-now-with-list-comprehensions-and-fancy-arguments","status":"publish","type":"post","link":"https:\/\/www.philhassey.com\/blog\/2008\/01\/16\/64k-tinypy-now-with-list-comprehensions-and-fancy-arguments\/","title":{"rendered":"64k tinypy &#8211; now with list comprehensions and fancy arguments"},"content":{"rendered":"<p>Well, I got two of my favorite python features added in &#8211; list comprehensions [x*x for x in range(1,5)] and fancy arguments test(1,2,a=3,*c,**d).<\/p>\n<p>Adding list comprehensions was painless, took only a few minutes.  The arguments change was rather difficult because I had to add more rules to the parser, change how the bytecode was outputted, and rework all the internal calling stuff in the VM.  Now every function takes a single argument of type &#8216;params&#8217; which can contain all the details of a call.<\/p>\n<p>I&#8217;ve also added in better error handling.  Errors print out a backtrace of the function calls and lines of code.  This is making debugging everything much easier.<\/p>\n<p>I&#8217;m also finding that the more features I add, well, the slower things get.  I&#8217;m also coming up against my 64k limit, so I&#8217;ve moved my tests out of the core code into a separate tests.py file to ensure that I don&#8217;t &#8220;trim down the tests&#8221; to give myself more space \ud83d\ude42  The tests I&#8217;ve made have been invaluable in making it possible to do big changes fairly quickly.<\/p>\n<p>Next on the agenda &#8211; either bootstrapping, or making a game with it \ud83d\ude42<\/p>\n<p>For the brave: svn:\/\/www.imitationpickles.org\/tinypy\/trunk ; python tests.py ; .\/run_julia_o3 (not very fast)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well, I got two of my favorite python features added in &#8211; list comprehensions [x*x for x in range(1,5)] and fancy arguments test(1,2,a=3,*c,**d). Adding list comprehensions was painless, took only a few minutes. The arguments change was rather difficult because I had to add more rules to the parser, change how the bytecode was outputted, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,6,8,2,32],"tags":[],"class_list":["post-56","post","type-post","status-publish","format-standard","hentry","category-crazy","category-development","category-languages","category-python","category-tinypy"],"_links":{"self":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts\/56","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/comments?post=56"}],"version-history":[{"count":0,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts\/56\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/media?parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/categories?post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/tags?post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}