[Tutor] class problem

Roelof Wobben rwobben at hotmail.com
Sat Sep 18 11:14:03 CEST 2010


Hello, 

I have this exercise :

Create and print a Point object, and then use id to print the
object’s unique identifier. Translate the hexadecimal form into decimal and
confirm that they match.

So I thought that this would solve it:

class Point:
    def __init__(self, x=0, y=0):
        self.x = x
        self.y = y


P=(Point)
a=0 
b=0
a=id(P)
print a 
print b
print P

But now id is a decimal so I don't can't translate it.
Did I something wrong ?

Roelof

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100918/adef21df/attachment.html>


More information about the Tutor mailing list