Re: [pygame] Declaring variables in function as if at code's line-level

2012-03-12 Thread Julian Marchant
> Many of my variables' names are re-stating the exact value they hold, so I > rarely have any confliction with names: > > filename_of_current_level = 'desert.txt' > Font__New_Times_Roman_size_20 = ... > pi_divided_by_180 = math.pi() / 180 > etc. > > The names are just according to what values they

Re: [pygame] Declaring variables in function as if at code's line-level

2012-03-12 Thread Ryan Hope
This thread needs to die. On Mon, Mar 12, 2012 at 3:55 PM, Sam Bull wrote: > On Mon, 2012-03-12 at 12:27 -0700, Brian Brown wrote: >> or like: "random.random()"   instead of just: >> >> "RANDOM_NUMBER_BETWEEN_0_AND_1()" >> >> >> "Pygame dot draw dot line" (It sounds so lame too) >> > > "RANDOM un

Re: [pygame] Declaring variables in function as if at code's line-level

2012-03-12 Thread Sam Bull
On Mon, 2012-03-12 at 12:27 -0700, Brian Brown wrote: > or like: "random.random()" instead of just: > > "RANDOM_NUMBER_BETWEEN_0_AND_1()" > > > "Pygame dot draw dot line" (It sounds so lame too) > "RANDOM underscore NUMBER underscore BETWEEN underscore ZERO underscore AND underscore ONE ope

Re: [pygame] Declaring variables in function as if at code's line-level

2012-03-12 Thread Christopher Night
On Mon, Mar 12, 2012 at 3:27 PM, Brian Brown wrote: > Thanks for the replies everyone. > I guess Python just doesn't have a > "declare-variable-as-global-for-whole-module" feature. > > (I don't generally have problems with variable overlap because I'm very > careful with naming my global variable

Re: [pygame] Declaring variables in function as if at code's line-level

2012-03-12 Thread Nick Arnoeyts
If you don't like the programming style of Python, maybe you should take a look at another language. I personally recommend Ruby (dynamic typing) or Java (static typing). Also, it's important to take a break every now and then ;) Don't forget to have fun! Op 12 maart 2012 20:27 schreef Brian Bro

Re: [pygame] Declaring variables in function as if at code's line-level

2012-03-12 Thread Brian Brown
Thanks for the replies everyone. I guess Python just doesn't have a "declare-variable-as-global-for-whole-module" feature. (I don't generally have problems with variable overlap because I'm very careful with naming my global variables.) (I just remembered though-- for some reason, list-type varia

Re: [pygame] Game not running

2012-03-12 Thread Avirup Kundu
Well i used the pickle module.. Like this! def highscore(s): with open('highscore.pkl', 'r+b') as f: score = pickle.load(f) for i in range(len(score)): if s > score[i-1]: score[len(score)-1] = s break score.sort() score.reverse() with ope