can a class intantiate itself to None?
Timothy Grant
tjg at exceptionalminds.com
Fri Mar 16 14:22:11 EST 2001
I'd like to create a class that can instantiate itself to None
when instantiation fails...
class foo:
def __init__(self, bar):
if type(bar) == StringType:
self.data = 'This is a String'
x = foo('a')
y = foo(1) # In this instance I would like y to be None
So, can it be done, or do I need to raise an exception, catch
it and then set y to None?
--
Stand Fast,
tjg.
Timothy Grant tjg at exceptionalminds.com
Red Hat Certified Engineer www.exceptionalminds.com
Avalon Technology Group, Inc. <>< (503) 246-3630
>>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
>>>>This machine was last rebooted: 58 days 23:33 hours ago<<
More information about the Python-list
mailing list