On Tue, Oct 18, 2016 at 9:50 PM, Rustom Mody <rustompm...@gmail.com> wrote:
> Now we can functionalize all this by making 'the world' as a parameter to our 
> functions.
> Greg talks of this as do other writings on functional IO
> I personally find talking of 'world' as though its an object in my little
> world to be a sleight of hand.

There is some value in this concept. If you're trying to unit-test
something, you need to be able to pin down all the inputs and outputs
of a piece of code. Thus, when you document that code, you need to
acknowledge that "the world" is one of its inputs - and that unit
testing it requires either access to said world, or a mocked version
of the significant parts of it.

Doesn't magically make the function pure, except in the trivial and
useless sense that mutable globals just count as inputs and outputs,
and thus all functions are pure.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to