Inheritance Confusion

Courageous jkraska1 at san.rr.com
Wed May 2 21:52:39 EDT 2001


>Andrew, thanks for pointing out my (now) glaring error. I will consider 
>myself suitably syntactically challenged and promise to check before I post 
>next time!

No big deal. You might find it helpful to play around with the following, however:
----
IDLE 0.6 -- press F1 for help
>>> class C:
	def __init__(self):
		pass
	def _init__(self):
		pass
>>> c = C()
>>> print C.__dict__
{'__init__': <function __init__ at 0102DA84>, '__doc__': None, '_init__': <function
_init__ at 01030FE4>, '__module__': '__main__'}
>>> print c.__dict__
{}
>>> C.__dict__["__init__"]
<function __init__ at 0102DA84>
>>> 
----
One fo the first things you need to learn as a new pythonista is how to go straight
into the interpreter and diagnose your problems interactively. The ease of problem
solving goes up dramatically this way, mark my words.


C//





More information about the Python-list mailing list