On Dec 27, 8:16 am, Scott David Daniels <scott.dani...@acm.org> wrote: > Martin wrote: > > ... > > class MailAddress(object): > > def __init__(self, address=None): > > self.address = address > > def __str__(self): > > if address: > > return self.adress > > return "NULL" > > There is an obvious typo above: > > if address: > should be: > if self.address: > > Or, you could replace the __str__ function with: > def __str__(self): > return self.address or "NULL"
The above all have the same characteristic: if the input is a zero- length string, then NULL is inserted into the database instead of a zero-length string. Some folks (not just pedants!) regard that as an important difference. -- http://mail.python.org/mailman/listinfo/python-list