News for hackers. Stuff that matters.
Re:PyParallel: How we removed the GIL and exploited all cores by RodericDay on Saturday June 07, 2014 @03:21PM (#7862822)
I kinda wish I could keep all the type definitions in a separate file, myself. Like a map of the project.

That would probably make it easier to decouple from "Normal" python code too.

I'm not a very senior software dev or anything, but I imagine myself liking having my well-written, compact .py file detailing logic, and a separate 'doc'(?) file containing long-winded explanations of what some key functions do, and listing all the type consistencies I absolutely wish to guarantee.

Re:PyParallel: How we removed the GIL and exploited all cores by ak217 on Saturday June 07, 2014 @04:54PM (#7863072)
Have you used Sphinx for documenting your project? (You can also use RtD - for example, https://ensure.readthedocs.org/ has the docs for the project linked above). Sphinx makes it fairly straightforward to inline documentation and code while maintaining highly readable docs. Also, you can collapse and otherwise manage doctrings in IDEs like PyCharm.

So, if I were to implement what you said, I'd go with a file containing interface classes, i.e. classes that have getters/setters and type checking built in and documented, and another file defining logic operating on them.

Another pattern is to use something like:

    class Widget(object):
        ... define key constraints...
    """
    Long-winded docstring about do_stuff
    """
    from .impl import do_stuff
So all the implementation complexity of do_stuff is hidden in .impl (which also avoids stray exports).
Re:PyParallel: How we removed the GIL and exploited all cores by jnbiche on Saturday June 07, 2014 @05:02PM (#7863092)
>I kinda wish I could keep all the type definitions in a separate file, myself. Like a map of the project.

In fact, this is exactly what OCaml does (or can do)[0]. The interface file is not always required, but people usually include it for clarity, to make sure the compiler's type inference works according to their wishes, or to limit visibility of certain types and functions.

0. http://stackoverflow.com/a/3268836