On Monday, June 27, 2011 03:55:04 PM Yap Sok Ann wrote:
> Using the discriminator_on_association.py example, if I create a
> Customer instance without specifying the addresses attribute, the for-
> loop at the end will throw exception:
> 
> AttributeError: 'NoneType' object has no attribute 'addresses'
> 
> It works if I specify "addresses=[]", but that sounds like too much
> work :P Is there a workaround for this? Thanks.

You could simply override the __init__ method and pass a default argument. 
That would simplify your object constructions... Hope that helps.

-- 
Fayaz Yusuf Khan
Cloud developer and designer
Dexetra SS, Kochi, India
fayaz.yusuf.khan_AT_gmail_DOT_com
fayaz_AT_dexetra_DOT_com
+91-9746-830-823

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to