[Tutor] Class definition confusion
Sivaram Neelakantan
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
__main__.Point
>>> b = Point()
>>> b.x =3
>>> b.y =4
>>> print b.y
4
>>>
Why is it not throwing an error? This is confusing me a bit.
sivaram
--
More information about the Tutor
mailing list