为什么使用CharField的max_length等于2^n而其他人使用2^n-1?CharField max_length 2^n vs 2^n-1
例如:
在django.contrib.gis.db.backends.postgis.models(DJANGO 1.3):
class SpatialRefSys(models.Model, SpatialRefSysMixin): srtext = models.CharField(max_length=2048)
在django_openid_auth.models(djano-openid- AUTH 0.3):
class Nonce(models.Model): server_url = models.CharField(max_length=2047)
ALTH尽管这不是科学措施,但是2048 seems to be more popular than 2047,但255 is more popular than 256。 Django文档说,在MySQL max_length is restricted to 255 characters if you are using unique=True中。但是为什么我会在其他情况下使用2^n-1而不是od 2^n?