Can you use self in __str__
Seymore4Head at Hotmail.invalid
Fri Nov 28 04:31:50 CET 2014
On Thu, 27 Nov 2014 21:49:29 -0500, Dave Angel <davea at davea.name>
self.hand = 
# create Hand object
s = 'Hand contains '
for x in self.hand:
s = s + str(x) + " "
I am using 2.7 (Codeskulptor). This is working code. It starts with
an empty list that gets appended from a full deck of shuffled cards.
I don't really know how to post working code without posting a lot. I
am not being too successful in trying to post enough code to have it
work without posting the entire code.
Here is the link if you want to run it.
The print out looks like this:
Hand contains H4 DQ.
I can (and am) currently printing the hand like this:
My question is can you add (self) in the __str__ so when you issue the
command "print player" the "player" part is included in the __str__.
More information about the Python-list