Creating objects you don't actually want

Chris Lyon chris.lyon at spritenote.co.uk
Tue Feb 10 11:11:26 EST 2004


> You shouldn't delete sfx --- it won't exist.

aaah I see !!

>>> class fred:
... 	def __init__(self,param = None):
... 		if param:
... 			raise ValueError
... 
>>> f = fred()
>>> f
<__main__.fred instance at 0118B93C>
>>> g = fred(1)
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "<interactive input>", line 4, in __init__
ValueError
>>> g
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
NameError: name 'g' is not defined
>>> 


Thank you very much, I appear to have assumed once more !



More information about the Python-list mailing list