Opened 9 years ago

Closed 9 years ago

#25479 closed Cleanup/optimization (wontfix)

Remove unncessary "# -*- coding: utf-8 -*-" declarations

Reported by: Tim Graham Owned by: nobody
Component: Core (Other) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

PEP8 says, "Files using ASCII (in Python 2) or UTF-8 (in Python 3) should not have an encoding declaration." In files like django/core/checks/__init__.py which don't have non-ASCII characters, we should remove # -*- coding: utf-8 -*- .

Change History (4)

comment:1 by Aymeric Augustin, 9 years ago

But it's annoying to have to add the declaration when one introduces a non-ASCII character in a commit... What about adding this to the list of cleanups when we drop Python 2?

comment:2 by Tim Graham, 9 years ago

I haven't faced that annoyance myself. Instead I have asked many times during a code review for an unnecessary encoding declaration to be removed in a new file (often copied from an existing file where it's already not needed, so I figured this would help eliminate that issue). I suppose the removal can be automated when dropping Python 2, but we avoid some unnecessary git log entries in new files where encoding is never required between now and then. Anyway, if others are against ticket, I won't debate further.

I did add it to the Python 2 cleanup ticket (#23919).

comment:3 by Claude Paroz, 9 years ago

I think this is really a minor issue and we can live with that until we drop Python 2.

comment:4 by Tim Graham, 9 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top