From 4ef4364f4285dbc932038e20045606466eda5705 Mon Sep 17 00:00:00 2001 From: Travis Cook Date: Fri, 21 Jul 2017 15:32:06 -0700 Subject: [PATCH 1/2] [docs] Fix grammar in purity.rst --- docs/guide/purity.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/purity.rst b/docs/guide/purity.rst index e01ff38..472c3f9 100644 --- a/docs/guide/purity.rst +++ b/docs/guide/purity.rst @@ -8,7 +8,7 @@ The major problem we have is that one message (underlying implementation: :class through more than one component, and at the same time. If you wanna be safe, you tend to :func:`copy.copy()` everything between two calls to two different components, but that's very expensive. -Instead of that, we chosed the oposite: copies are never made, and you should not modify in place the inputs of your +Instead, we chose the opposite: copies are never made, and you should not modify in place the inputs of your component before yielding them, and that mostly means that you want to recreate dicts and lists before yielding (or returning) them. Numeric values, strings and tuples being immutable in python, modifying a variable of one of those type will already return a different instance. From dda0a6388026a94226050f1fa11b670eb7bf7504 Mon Sep 17 00:00:00 2001 From: Travis Cook Date: Fri, 21 Jul 2017 15:38:06 -0700 Subject: [PATCH 2/2] [docs] Fix additional grammar issues at bottom of purity.rst --- docs/guide/purity.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guide/purity.rst b/docs/guide/purity.rst index 472c3f9..bd20d4e 100644 --- a/docs/guide/purity.rst +++ b/docs/guide/purity.rst @@ -130,10 +130,10 @@ Now let's see how to do it correctly: I hear you think «Yeah, but if I create like millions of dicts ...». -Let's say we chosed the oposite way and copy the dict outside the transformation (in fact, `it's what we did in bonobo's +Let's say we chose the opposite way and copied the dict outside the transformation (in fact, `it's what we did in bonobo's ancestor `_). This means you will also create the -same number of dicts, the difference is that you won't even notice it. Also, it means that if you want to yield 1 million -times the same dict, going "pure" makes it efficient (you'll just yield the same object 1 million times) while going "copy +same number of dicts, the difference is that you won't even notice it. Also, it means that if you want to yield the same +dict 1 million times , going "pure" makes it efficient (you'll just yield the same object 1 million times) while going "copy crazy" will create 1 million objects. Using dicts like this will create a lot of dicts, but also free them as soon as all the future components that take this dict