[Tutor] Python object

2011-02-24 Thread Christopher Brookes
Hi, i'm new in python. I'm trying to create a small fight program in object. I've created __init__ (its works) but when i'm trying to display init param i'm getting param and "None" every time. Why ? def GetAllAtrib(self): print '---' pr

[Tutor] Dictionnaries in object

2011-02-24 Thread Christopher Brookes
Hi, I want to create some powers in my fight program. I want to know if dictionnaries is the best solution to do it. For now its look like this : //French name and description, don't care about it ;) power1= {} power1['Name'] = 'Flammes infernales' power1['Description'] = 'Embrase lenemi et le

[Tutor] Display all field of a listuples

2011-02-24 Thread Christopher Brookes
Hi i would like to display all the field of my powerAll like this : Choose a power : Froid devorant : Embrase lenemi et le feu bruler Flammes infernales : 'Gele lenemi sur place - class Character(): def ChoosePouvoirUnique(self): print ("Choose a power")

Re: [Tutor] Display all field of a listuples

2011-02-24 Thread Christopher Brookes
devorant', 'Gele lenemi sur place')] hero1 = Character("Klaitos") hero1.ChoosePouvoirUnique() im *WANT to display this* : Froid devorant : Gele lenemi sur place Flammes infernales : Embrase lenemi et le feu bruler I don't know how to get this ? :( 2011/2/24 Steven D&#

Re: [Tutor] Display all field of a listuples

2011-02-25 Thread Christopher Brookes
It's works. Thank you all. 2011/2/25 bob gailer > On 2/24/2011 4:54 PM, Christopher Brookes wrote: > > Hi i would like to display all the field of my powerAll like this : > > Choose a power : > Froid devorant : Embrase lenemi et le feu bruler > Flammes infernale

[Tutor] Search function in a list-tuples

2011-02-25 Thread Christopher Brookes
Hi, is there a better way to do this ? (*heros are Character*) herosAll = [ Character(0,"Chris","Soldat fort",type[0],15,5,8,50,1), Character(1,"Antaa","Soldat moins fort",type[0],15,5,8,50,1)] def HeroExist(HerosName): herosId = -1 for heros in herosAll: if HerosName

Re: [Tutor] Search function in a list-tuples

2011-02-25 Thread Christopher Brookes
st print. You are using double quotes > around the string so you can just type the single quote directly > > print ( "This hero doesn't exist') > > Alan G. > > 2011/2/25 Alan Gauld > >> "Christopher Brookes" wrote >> >> Hi, is there a

[Tutor] Object, methods, class

2011-02-26 Thread Christopher Brookes
Hi, Is there in Python private/protected attributes in class like in other langage ? -- Brookes Christopher. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Multiples python files

2011-02-28 Thread Christopher Brookes
Hi, first sorry for my poor english, i'm a french guy, i'm trying to make the best :( I would like to split my python script into multiples files. I want : A file which contains only class creations and methods, A file with some personals functions And a main.py which is the main script. But i'm

Re: [Tutor] Multiples python files

2011-02-28 Thread Christopher Brookes
gt; for heros in herosAll: >> heros.DisplayCharacterInfos() >> >> herosAll = [ >> Character(1,"Antaa","Soldat moins fort",15,5,8), >> Character(2,"Klaitos","Soldat moins fort",15,5,8)] >> >> Character.Dis

Re: [Tutor] Multiples python files

2011-03-01 Thread Christopher Brookes
Thank you all for answers. Again. 2011/2/28 Alan Gauld > > "Christopher Brookes" wrote > > > I don't understand >> >> @classmethod >> def DisplayAll(cls, herosAll): >> >> What is cls ? >> > > This is one of the a