On Sep 13, 2006, at 7:09 PM, Gary Wilson wrote: > > Out of curiosity, any one know for what reason using empty strings for > CharFields is the Django convention? Technically, isn't an empty > string still data? Isn't it a bit confusing that some fields get > default values and others do not? Explicit better than implicit?
My guess is that you need less code when you can assume that all text columns in the database contain strings. Python strings are first- class objects and so have instance methods you can call by appending the function call onto the variable. If you had nulls returned from those text columns, then every time you wanted to execute a string function, you'd have to test for None, then convert it. Then with a test, you may waste code AND cycles because if you code if not string: string = '' string.split(...) half the time you may be assigning an empty string to a variable that already contains an empty string. That's one reason I can think of, there may be others. Don --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---