Laboratory

Dev tools

testing library

SHOW HN2016

Laboratory

A Python port of GitHub's Scientist library for refactoring

github.com

#python#refactoring#scientist#experiments#github

153points
13comments
#212of 2,264 in 2016
Top 10%of 2016 by points

How HN took it

CuriousMostly questions and neutral comments

3 positive, 5 neutral or asking, 0 mixed, 0 critical, out of 8 comments about the project. Thread score +0.29.

Idea: 1 for, 0 againstExecution: 1 for, 0 againstDesign: 1 for, 0 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Python's with statement suits the wrapper design

    From 1 comment
    • 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…
      jack_jennings on HN
  • Useful for verifying cache or refactor changes

    From 1 comment
    • 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…
      agentultra on HN

Objections

  • Only safe for code without side effects

    From 2 comments
    • It only should be used for code which doesn't have side effects. According to original github lib.
      tomtompl on HN
    • 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…
      chucksmash on HN
  • Context manager is less clean than a decorator

    From 2 comments
    • I would argue that python provides even simpler syntax to enable functionality like this. ``` @experiment.with(new_function) def old_function() ... ```
      chronial on HN
    • Agreed -- a decorator seems like a much cleaner way to handle this.
      shoyer on HN
  • Python itself is declining in popularity

    From 1 comment
    • Python? Isn't Python dying? ;) https://news.ycombinator.com/item?id=11100251
      jonathankoren on HN

Requests

  • Offer a decorator version as well as the context manager

    From 2 comments
    • I would argue that python provides even simpler syntax to enable functionality like this. ``` @experiment.with(new_function) def old_function() ... ```
      chronial on HN
    • 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…
      buttscicles on HN

Questions

  • How does it handle code that changes state?

    From 1 comment
    • I imagine this can only work on getters? How do you use this when code makes state changes?
      lasdfas on HN

Alternatives named

  • Other ports of Scientist in PHP, JavaScript, and Python

    From 2 comments
    • Here's some other ports of Scientist I've come across as well: PHP https://github.com/LartTyler/Analyst Javascript https://github.com/trello/scientist…
      nubs on HN
    • Another Python one: https://github.com/staticshock/scientist.py
      ByteJuggler on HN
  • Original GitHub Scientist library in Ruby

    From 1 comment
    • 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…
      chucksmash on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/11104781)