tag:blogger.com,1999:blog-2551316030266117621.post3056267048281299522..comments2024-02-28T14:15:39.058-06:00Comments on Official Harlan Tytus Beverly Blog: Python Training Part 3 (of 4)Anonymoushttp://www.blogger.com/profile/08004493835199297259noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-2551316030266117621.post-9821949863738237542013-11-22T16:25:24.274-06:002013-11-22T16:25:24.274-06:00I've fixed a bug in my code that Rafael found ...I've fixed a bug in my code that Rafael found for me (Thanks Rafael)! In general, you don't want to put member variables outside of your __init__ class... because it becomes a class attribute... (for all members of the class! eeek!)<br /><br />So this is wrong:<br />class Location(object):<br /> #MemberVariables<br /> x=0<br /> y=0<br /> z=0<br /> def __init__(self,,z):<br /> self.z = z<br /><br />And this is right:<br />class Location(object):<br /> #MemberVariables<br /> #x=0, y=0, z=0<br /> def __init__(self,,z):<br /> self.x = 0<br /> self.y = 0<br /> self.z = z<br />Anonymoushttps://www.blogger.com/profile/08004493835199297259noreply@blogger.com