Subject: DocOz Episode Recap

From: DocOz Exclusive <[email-masked]>
Date: Tue, 13 May 2014 12:04:01 -0700

Weight-Loss Trick for EVERY Body Type

Melt Fat no matter what your shape. 
This proven tip will have you shedding pounds in a few days.

Kiss that Fat goodbye immediately.

View DocOz Clip: http://www.pipeem.com/DocOz/Episode/Clip/No401.video
Episode 401

Get comfortable in you own skin once and for all...

- DocOz Show

message setting modifications to Urgent Info Services 
at 3-2-0-5/Lake Sarah/Independence/MN/55359
http://www.pipeem.com/sk4nr5.sngvke

just return pricelist from function1.   RanRag Feb 2 '12 at 22:45
1	  	
There is a severe lack of code being presented here   jdi Feb 2 '12 at 22:47
  	  	
but they are not actually feeding into each other. function1 happens then a bunch of other functions then it gets to function2. I can keep passing them down the chain but I thought there would be a better way.   Lostsoul Feb 2 '12 at 22:48
1	  	
@Lostsoul - having at least more understanding of what you are trying to achieve IS relevant. Most likely there is a design issue here. Maybe you need to use class structures. Maybe you do need a global constant in one of your modules. Only you know the context.   jdi Feb 2 '12 at 22:50
I understand what your saying and I'm sorry, I think I didn't provide some details(I didn't realize they were relevant). I can't import moduleA into moduleB because I'm already importing moduleB into moduleA and it get errors when I do a circular import. typically this is what I do, and then refer to the variable as moduleA.constList Also, function200 is not being called directly from function1, function1 kind of sends to other functions based on results within its own function, and so on until a function(could be several functions later) sends to function2000   Lostsoul Feb 2 '12 at 23:05
  	  	
You probably just need to use classes and rethink the organization of your program. There is always an entry point, and something is using something else. Even if there are 200 pieces of logic between those two function calls, it would eventually unwind back up to the top of the stack where pricelist exists. Sorry we couldn't give you more of a concrete solution.   jdi Feb 2 '12 at 23:12
  	  	
Thank you, I think you gave me a great solution. I learned programming in highschool(very basic) almost 2 decades ago and I didn't learn OO very well so I just avoided using it. This problem showed me a reason to use it and learn. Codes getting unnecessary complicated and messy, so I'll just take it as a chance to learn using classes. Thank you for setting me on the right direction. 	
okay thats what I needed to know I guess. Your right, I am not that good with object oriented programming so I was sticking to what I was more confortable with(functions). I guess I'll bite the bullet and use objects, I guess it'll be a good time to learn. Than
What do you mean by "I assume?" Did you not write this class? Also, you do not assign anything to the enemy attribute of this class in your constructor, so you obviously are not assigning self.enemy in the Enemy class.
Then you can get the health by saying enemy_dict[name]. You have to choose a name, though - you can make sure you are choosing a valid name by saying if name in enemy_dict.keys(). You can now say an_enemy = Enemy(name, enemy_dict[name]).If you want to implement "random encounters," it's as easy as using the random module. You already use random.choice - so this shouldn't be too hard. Just use enemy_dict.keys() instead if you are using a dictionary.self.enemy = random.choice(enemy_dict.keys())
The above code makes the enemy attribute be the name, which is the key for that dictionary. To get the health, of course, it's enemy_dict[self.enemy].You should note that if you modify the health in the enemy_dict, that will affect every object's perception of that enemy's health. If your enemy_dict represents unique entities, that's fine - but if you wanted to have more than one "sprite", you could use the enemy_dict as a type of lookup table from which to get random types of enemies to fight, and you would do better to use something like this:self.enemy_name = random.choice(enemy_dict.keys())self.enemy_health = enemy_dict[self.enemy_name]
Furthermore, you are trying to call .keys() and .values() on enemy_dict which is a list. It doesn't have those methods. If it were a dict, you would be trying to assign something like ['sprite', 'thief'] to the enemy's name anyway, and likewise [5, 10] to the health.You also are not passing enemy_dict as an argument to Enemy's __init__. You should, if you wrote this class yourself, change it to be:def __init__(self, name, health):
    self.name = name
    self.health = values
And call it like so: an_enemy = Enemy(enemy_dict[0][0], enemy_dict[0][1]). This is assuming you are not going to change enemy_dict, which you really should do. Might I suggest: