Adds the logfile

They say that using the with statement is not a foolproof method, because
some types do not have context managers (and it looks like even in 3.4, not
every context-capable type has been migrated :
http://stackoverflow.com/questions/26619404/with-and-closing-of-files-in-python),
so using the with statement with stdlib types might or might not work
depending on the type you are using.

the "different" with statement is actually wrapping you object in another
one with a .close() function, which might even not work if the teardown
behavior is not located within the .close() method ...

unfortunately, reading the documentation does not make me more comfortable
with the "with" statement : while I can see myself using it with classes I
would have written myself (where I control the context properly), it looks
like using the context manager is still a hit and miss game.

Since it does not land you any performance improvement, makes the code
harder to understand, while being less obvious about what is happening, and
gives you the discutable habit of opening file handlers without closing
them, I think I will pass on using it.

I am sorry that you feel that this is trolling, but for me, understanding
the mechanism behind a langage is something interesting. When to use which
statement , their advantages and drawbacks are, I think, things that will
make me become better at writing python.

On Thu, Oct 30, 2014 at 10:05 AM, Mario Giovacchini <
notifications@github.com> wrote:

> In scripts/readscount.py:
>
> >
> > +
> > +    f=open("AggregationLog.csv", "w")
>
> Well I mean really they just tell you to use a different with statement
> if you're *not* using files and you want to be real careful:
>
> from contextlib import closingimport urllib
> with closing(urllib.urlopen('http://www.python.org')) as page:
>     for line in page:
>         print line
>
> (from https://docs.python.org/2/library/contextlib.html#contextlib.closing
> )
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/SciLifeLab/genologics/pull/77/files#r19593155>.
>