[Baypiggies] tip for moving to Python 3

Keith Dart keith at dartworks.biz
Sat Aug 28 00:28:00 CEST 2010


FYI, I started putting the following in my new Python 2.x code:

from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals

(up near the top, first code lines), and also:

#!/usr/bin/python2.6
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab:fenc=utf-8

At the very top. This tells both Python and the editor (if it's vim)
that the file contains utf-8 strings.

This is to prepare the code (and my mind) for Python 3. 



-- 
-- ------------------------------
Keith Dart
=================================



More information about the Baypiggies mailing list