News for hackers. Stuff that matters.
Re:Ask HN: I am a data analyst and my code is a mess by mc_hammer on Wednesday December 03, 2014 @10:33AM (#8694205)
not a python dev, but:

- python probably has a lib like underscore (reduce map filter etc), could help

- check out the quake source code, any version, its huge and the entire thing is not only readable but possibley a work of art.

- have you tried lambdas? to some its more readable.. ex:

    nums = range(2,50)
    for i in range(2, 8):
        nums = filter(lambda x: x == i or x % i, nums)
personally when i have too complex process i like to go more functional, ex:

    main:
        prepare_data1()
        prepare_data2()
        do_long_stuff()
        nextstep()
that allows me to focus on only on building one step and still have readable code.

many game-devs prefer breaking their project into many tiny files with a specific purpose instead of spaghetti, ex:

    file.py
    parser.py
    display.py
    function1.py
    function2.py
its also a bit easier to nav around the project and make sense of it this way. you might want to check out rust or D or F or another lang also.
Re:Ask HN: I am a data analyst and my code is a mess by elliott34 on Wednesday December 03, 2014 @03:02PM (#8696013)
Definitely see what you're saying with the prepare_data1()...prepare_data(2). Maybe a more functional approach would be suitable. At the end of the day, data goes into a tunnel and comes out in a different form, into a machine learning model. So perhaps I should look at functional programming styles in python. Thanks!
Re:Ask HN: I am a data analyst and my code is a mess by TheLoneWolfling on Wednesday December 03, 2014 @10:51AM (#8694300)
Python has a built-in map. Reduce is in functools. Filter is in itertools.

Between builtins, itertools, and functools, you pretty much have it covered.

Re:Ask HN: I am a data analyst and my code is a mess by elliott34 on Wednesday December 03, 2014 @03:07PM (#8696042)
Excuse my ignorance here: so are these functional programming paradigms?
Re:Ask HN: I am a data analyst and my code is a mess by TheLoneWolfling on Wednesday December 03, 2014 @03:45PM (#8696238)
Re:Ask HN: I am a data analyst and my code is a mess by mc_hammer on Wednesday December 03, 2014 @12:43PM (#8695136)
Thought so - python is a rly nice lang