Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46691
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jason.swails@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'package,': 0.03; 'subject:Python': 0.06; 'duplicate': 0.07; 'important,': 0.07; 'result,': 0.07; '2to3': 0.09; 'exception,': 0.09; 'subject:skip:c 10': 0.09; 'runs': 0.10; 'python': 0.11; 'project,': 0.12; 'wrote': 0.14; '(next': 0.16; 'err:': 0.16; 'quantum': 0.16; 'syntax,': 0.16; 'to:name:python list': 0.16; 'exception': 0.16; 'module': 0.19; 'everyone,': 0.19; 'possible,': 0.19; 'ph.d.': 0.24; "i've": 0.25; 'script': 0.25; 'tried': 0.27; 'appreciated.': 0.29; 'unix': 0.29; 'field,': 0.30; 'primarily': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; 'exceptions': 0.31; 'compatible': 0.32; 'thanks!': 0.32; 'linux': 0.33; 'actively': 0.33; 'candidate': 0.34; 'role': 0.34; "i'd": 0.34; 'could': 0.34; 'except': 0.35; 'possible.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'ubuntu': 0.36; 'should': 0.36; 'project': 0.37; 'jason': 0.38; 'to:addr :python-list': 0.38; 'rather': 0.38; 'heard': 0.39; 'supporting': 0.39; 'to:addr:python.org': 0.39; 'university': 0.39; 'catch': 0.60; 'course': 0.61; 'soon': 0.63; 'become': 0.64; 'more': 0.64; '(that': 0.65; 'due': 0.66; 'news': 0.67; 'florida': 0.78; 'introduce': 0.78; 'ships': 0.84; '\xa0of': 0.84; 'migrating': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=aHw6k6Saa+/9hjHgfSnZmKet9fdBy/NYB4vKraOP/Gg=; b=WrvgpRGkM5BHPmUzF0qh9GXMsYeKAJxb+rq/60UZQmJ+6v+9CDXhCdvEwdehc8vrNd 6pUTQu3FXiJdDeqmMkomKsv7bIx1S81hqa0eBjW0yznOoAPX47drkSFQGBHFn39YqaWL /PzE8sg0ueLJwdmx4HUdSLwf+jqijPmyE1H4iVh9ukz2x+o5qggRfzq2l7KsSnUYQJAJ HkVuh9aEfOGrQlrLf6Ro7Q5uhHgih1VbXIfv8Uy/bcb8hsfuGnjqhhWEgdkUwuOYmCqV DE+hCBSX+z/3jRBMETXGGeHlqImFhuZBgw8kmi6xzBckYKEkYauS2DG8FmxVMR5B8oGT P+SQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.42.250.202 with SMTP id mp10mr8567829icb.21.1370182417589; Sun, 02 Jun 2013 07:13:37 -0700 (PDT) |
| Date | Sun, 2 Jun 2013 10:13:37 -0400 |
| Subject | Python 2-3 compatibility |
| From | Jason Swails <jason.swails@gmail.com> |
| To | python list <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=20cf3010e6c9472a4504de2c7442 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2542.1370182425.3114.python-list@python.org> (permalink) |
| Lines | 95 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1370182425 news.xs4all.nl 15986 [2001:888:2000:d::a6]:55885 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:46691 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hello Everyone, I have a Python script that I wrote to support a project that I work on (that runs primarily on Unix OSes). Given its support role in this package, this script should not introduce any other dependencies. As a result, I wrote the script in Python 2, since every Linux currently ships with 2.4--2.7 as its system Python (RHEL 5, still popular in my field, ships with 2.4). However, I've heard news that Ubuntu is migrating to Python 3 soon (next release??), and that's a platform we actively try to support due to its popularity. I've tried writing the code to support both 2 and 3 as much as possible, but with priority put on supporting 2.4 over 3. Now that Python 3-compatibility is about to become more important, I'm looking for a way to catch and store exceptions in a compatible way. Because Python 2.4 and 2.5 don't support the except Exception as err: syntax, I've used except Exception, err: Is there any way of getting this effect in a way compatible with Py2.4 and 3.x? Of course I could duplicate every module with 2to3 and do sys.version_info-conditional imports, but I'd rather avoid duplicating all of the code if possible. Any suggestions are appreciated. Thanks! Jason -- Jason M. Swails Quantum Theory Project, University of Florida Ph.D. Candidate 352-392-4032
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Python 2-3 compatibility Jason Swails <jason.swails@gmail.com> - 2013-06-02 10:13 -0400
csiph-web