[Pulp-list] Python Module Header

Nick Coghlan ncoghlan at redhat.com
Fri Oct 26 00:09:40 UTC 2012

On 10/26/2012 06:22 AM, Randy Barlow wrote:
> On 10/25/2012 04:08 PM, Randy Barlow wrote:
>> I'd put a mild +0.1 I suppose.
> I'll clarify why it's mild. I love UTF-8. I want to use UTF-8 in my
> Python code, and I like that Python 3 is UTF-8.
> However, I don't think that it looks nicer in Python 2 land to have this
> ugly Perl-like thing at the top of the file just so we can write the ©
> character. If we were Python 3, I'd be all about having that © though…
> (and ellipses…) (and unicode snowmen ☃…)

FWIW, the ugly Perl like thing is only needed if you want Emacs to
understand it. If you only care about Python and not Vim or Emacs, then
all you should need is something like:

# Encoding: utf-8

Details are in http://www.python.org/dev/peps/pep-0263/

Interestingly, the tutorial only shows the Emacs way (I guess for

The language reference at least gives the exact regex, but again, only
shows the examples that the editors understand, omitting the simpler


Nick Coghlan
Red Hat Infrastructure Engineering & Development, Brisbane

Python Applications Team Lead
Beaker Development Lead (http://beaker-project.org/)
GlobalSync Development Lead (http://pulpdist.readthedocs.org)

More information about the Pulp-list mailing list