[{"data":1,"prerenderedAt":212},["ShallowReactive",2],{"project-11104781":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":29,"sentiment":30,"stance_mix":31,"scored_comments":35,"aspects":36,"strip":41,"post_text":42,"what":43,"said":65,"maker_in_thread":141,"shape":144,"grid":147,"attempts":174,"same_week":175,"maker_shows":38,"maker_hidden":204,"reader_version":205,"card":206},"11104781","Laboratory","A Python port of GitHub's Scientist library for refactoring","title","Show HN: Laboratory, a Python port of GitHub's Scientist library for refactoring","https:\u002F\u002Fgithub.com\u002Fjoealcorn\u002Flaboratory","github.com","buttscicles",1455558921,2016,153,13,212,2264,10,"notable","dev_tools","testing library","library",[24,25,26,27,28],"python","refactoring","scientist","experiments","github","curious",0.294,{"positive":32,"neutral":33,"mixed":34,"critical":34},3,5,0,8,{"idea":37,"execution":39,"design":40},{"positive":38,"critical":34},1,{"positive":38,"critical":34},{"positive":38,"critical":34},[34,34,32,32,32,33,32,33,32,34,34,33,34],null,{"problem":44,"audience":54,"pricing":42,"motivation":42,"time_to_build":42,"stack":58,"openness":64,"stage":64,"team_size":64},{"value":45,"source":46,"evidence":47},"Safely refactoring code by comparing old and new implementations at runtime","inferred",[48,50],{"id":49},"post",{"id":51,"by":52,"text":53},"11105359","chucksmash","From Github's Scientist [1]: Because `enabled?` and `run_if` determine when a candidate runs, it's impossible to guarantee that it will run every time. For this reason, Scientist…",{"value":55,"source":46,"evidence":56},"Python developers refactoring code",[57],{"id":49},[59],{"value":60,"source":61,"evidence":62},"Python","maker",[63],{"id":49},"unknown",{"praise":66,"objections":82,"requests":109,"questions":117,"alternatives":125},[67,75],{"value":68,"source":69,"evidence":70},"Python's with statement suits the wrapper design","commenter",[71],{"id":72,"by":73,"text":74},"11106725","jack_jennings","Before clicking the link I wondered how this would translate the block-based Ruby API into Python. Using Python's with statement is quite nice here, I think. The with statement…",{"value":76,"source":69,"evidence":77},"Useful for verifying cache or refactor changes",[78],{"id":79,"by":80,"text":81},"11105237","agentultra","Cool! Thanks for the tool! > Imagine you've implemented a complex caching strategy for some objects in your database and a stale cache is simply not acceptable. I hope you have a…",[83,91,102],{"value":84,"source":69,"evidence":85},"Only safe for code without side effects",[86,90],{"id":87,"by":88,"text":89},"11105311","tomtompl","It only should be used for code which doesn't have side effects. According to original github lib.",{"id":51,"by":52,"text":53},{"value":92,"source":69,"evidence":93},"Context manager is less clean than a decorator",[94,98],{"id":95,"by":96,"text":97},"11106773","chronial","I would argue that python provides even simpler syntax to enable functionality like this. ``` @experiment.with(new_function) def old_function() ... ```",{"id":99,"by":100,"text":101},"11107714","shoyer","Agreed -- a decorator seems like a much cleaner way to handle this.",{"value":103,"source":69,"evidence":104},"Python itself is declining in popularity",[105],{"id":106,"by":107,"text":108},"11105693","jonathankoren","Python? Isn't Python dying? ;) https:\u002F\u002Fnews.ycombinator.com\u002Fitem?id=11100251",[110],{"value":111,"source":69,"evidence":112},"Offer a decorator version as well as the context manager",[113,114],{"id":95,"by":96,"text":97},{"id":115,"by":11,"text":116},"11108834","This was my thought as well, and it's also a bit more awkward if your function signatures differ. Luckily they aren't mutually exclusive and it should be easy to implement a…",[118],{"value":119,"source":69,"evidence":120},"How does it handle code that changes state?",[121],{"id":122,"by":123,"text":124},"11105276","lasdfas","I imagine this can only work on getters? How do you use this when code makes state changes?",[126,137],{"value":127,"source":69,"evidence":128},"Other ports of Scientist in PHP, JavaScript, and Python",[129,133],{"id":130,"by":131,"text":132},"11105715","nubs","Here's some other ports of Scientist I've come across as well: PHP https:\u002F\u002Fgithub.com\u002FLartTyler\u002FAnalyst Javascript https:\u002F\u002Fgithub.com\u002Ftrello\u002Fscientist…",{"id":134,"by":135,"text":136},"11136920","ByteJuggler","Another Python one: https:\u002F\u002Fgithub.com\u002Fstaticshock\u002Fscientist.py",{"value":138,"source":69,"evidence":139},"Original GitHub Scientist library in Ruby",[140],{"id":51,"by":52,"text":53},{"comments":38,"answered":34,"key":142},[143],{"id":115,"text":116},{"commenters":15,"max_depth":33,"maker_replies":38,"first_comment_mins":145,"lifespan_hours":146},77,100,[148,150,153,155,156,157,160,162,164,167,169,170,173],[130,34,34,149,131,34],"other\u002Fneutral\u002Fnone",[151,34,34,149,152,34],"11105934","taspeotis",[122,38,32,154,123,34],"project\u002Fneutral\u002Fidea",[87,38,32,154,88,34],[51,38,32,154,52,34],[72,158,33,159,73,34],2,"project\u002Fpositive\u002Fexecution",[95,158,32,161,96,34],"project\u002Fneutral\u002Fdesign",[99,158,33,163,100,34],"project\u002Fpositive\u002Fdesign",[165,158,32,161,166,34],"11108047","msellout",[115,158,34,168,11,38],"maker\u002Fneutral\u002Fdesign",[134,32,34,149,135,34],[79,171,33,172,80,34],4,"maker\u002Fpositive\u002Fidea",[106,33,34,149,107,34],[],[176,180,184,189,194,199],{"id":177,"name":178,"points":179,"category":20},"11077823","Htop 2.0 released",613,{"id":181,"name":182,"points":183,"category":20},"11109600","Food Pairing Ninja",337,{"id":185,"name":186,"points":187,"category":188},"11106386","sense2vec.spacy.io",225,"ai",{"id":190,"name":191,"points":192,"category":193},"11080539","HN Replies",217,"consumer_social",{"id":195,"name":196,"points":197,"category":198},"11109438","Go-git",114,"languages",{"id":200,"name":201,"points":202,"category":203},"11102912","The Top Fives",106,"productivity",false,"v2",{"id":207,"name":5,"line":6,"ai":204,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":208,"top":18,"kw":209,"maker":11,"domain":10,"tier":19,"attempts":34,"strip":210,"url":9,"mix":211,"praise":68,"objection":84,"sub":21},11104781,0.29,[24,25,26,27,28],"0033353530050",[32,33,34,34],1794036540989]