Author Topic: My pet python project  (Read 873 times)

0 Members and 1 Guest are viewing this topic.

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
My pet python project
I've released my project for fan control on linux on  github


I'd appreciate it if someone well versed in python and or OOP could guide me to a better codebase :)
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline Spicious

  • Master Chief John-158
  • 210
Re: My pet python project
First off, go read http://legacy.python.org/dev/peps/pep-0008/ and http://google-styleguide.googlecode.com/svn/trunk/pyguide.html and follow them.
Use the provided logging library instead of rolling your own; it's good: https://docs.python.org/3/howto/logging.html.
Don't discard exceptions; an object failing to construct really should inform the caller.
Use tuples instead of lists for fixed sized things.
Use list and dict literals ([] and {}) instead of list() and dict().
Don't use __del__ if at all possible.

 

Offline Kopachris

  • 28
  • It's Pythonic
    • Steam
    • Twitter
    • HLP QuoteDB
Re: My pet python project
I was going to mention some of the stuff Spicious mentioned, but then I realized I'm not exactly the right person to ask for Python writing style advice.  My code is always a mess.  It works, but it's a mess.
--
Yo momma's so fat when she sits on a binary tree she flattens it to a linked list in constant time.

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: My pet python project
First off, go read http://legacy.python.org/dev/peps/pep-0008/ and http://google-styleguide.googlecode.com/svn/trunk/pyguide.html and follow them.
i find pep8 to be full of crap in some regards honestly. i've sticked with it mostly even though i find the 4 spaces way too cramped.

Quote
Use the provided logging library instead of rolling your own; it's good: https://docs.python.org/3/howto/logging.html.
I've missed that one whilst looking for builtins  :sigh:

Quote
Don't discard exceptions; an object failing to construct really should inform the caller.
And what? Have specific handlers in the caller? They are mostly being discarded at the time being anyhow as i hit a bit of a wall on how to proceed in that regard anyhow.
And i'm perfectly fine with them killing the program if they barf on a configuration error. I just need to set up the logging properly.

Quote
Use tuples instead of lists for fixed sized things.
Is there  a particular reason for this? And do contents of tuples have to be fixed as well?
Quote
Use list and dict literals ([] and {}) instead of list() and dict().
i blame my php background for those... i'll rework it :)
Quote
Don't use __del__ if at all possible.
it was the only reliable way to purge the pid on program exit that i could figure out, as running two instances tended to mess some things up fiercely... Do you reccomend a better way?


btw, Kopachris, i'm still open to ideas and reccomendations :)
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.