[Tutor] Class definition confusion
nsivaram.net at gmail.com
Wed Feb 15 19:14:19 CET 2012
I was under the impression that you have to define the attributes of
the class before using it in an instance. Following the book
'thinking in Python',
>>> class Point:
... """pts in 2d space"""
>>> print Point
>>> b = Point()
>>> b.x =3
>>> b.y =4
>>> print b.y
Why is it not throwing an error? This is confusing me a bit.
More information about the Tutor