Saturday, April 18, 2015

How can I share attribute in other class

I have two class, and I want use in method first_distribution_cards self.players from first class how can I do this?

class Game(object):

 
def __init__(self,name):
 
self.players=[]
 
self.dealer=Person("Dealer")
 
self.name=name
class Deck(object):

def first_distribution_cards(self):
 
for player in self.players:
 
for card in range(0,5):
 
self.player.hand.append(self.cards)
 
print(self.player.hand[card])




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3e3e42ea-5d8f-45c1-9a76-9388c9a5f8b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment