-2

Why does Django installed apps end with a comma at the end eg

INSTALLED_APPS = [
        'django.contrib.admin',
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.messages',
        'dj ango.contrib.staticfiles',
        'rest_framework',
]

Is the extra comma necessary?

  • Well, as far as I know, the extra comma is not necessary. But allowing an extra comma makes life easier: It is easier to remove the last element of the array and easier to append a new element to the array if the final comma is allowed. – Xaver Jan 13 '21 at 17:18

1 Answers1

0

No it's not necessary.

Check the following link:

Why are trailing commas allowed in a list?

Manolis P.
  • 195
  • 2
  • 14