public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Arfrever Frehtes Taifersar Arahesis <Arfrever@gentoo.org>
To: Gentoo Development <gentoo-dev@lists.gentoo.org>
Subject: Re: [gentoo-dev] Stabilization of Python 3.1
Date: Sun, 20 Sep 2009 19:57:05 +0200	[thread overview]
Message-ID: <200909201957.05957.Arfrever@gentoo.org> (raw)
In-Reply-To: <8b4c83ad0909201030s1ef74e70l1148f443360ebb51@mail.gmail.com>

[-- Attachment #1: Type: Text/Plain, Size: 1847 bytes --]

2009-09-20 19:30:54 Nirbheek Chauhan napisał(a):
> On Sun, Sep 20, 2009 at 8:54 PM, Arfrever Frehtes Taifersar Arahesis
> <Arfrever@gentoo.org> wrote:
> > 2009-09-20 16:53:37 Jesús Guerrero napisał(a):
> >> # eselect python set 2
> >> # emerge -s foo
> >>   File "/usr/bin/emerge", line 41
> >>     except PermissionDenied, e:
> >>                            ^
> >> SyntaxError: invalid syntax
> >>
> >>
> >> Ummm, yes, it works *beautifully*, you see. Nothing else to add.
> >
> > I have fixed it today :) .
> > http://sources.gentoo.org/viewcvs.py/portage?rev=14289&view=rev
> 
> This is silly. portage itself was broken with python-3.1 and you want
> to stabilize it?

You should distinguish between Python version used by Portage and
Python version used by packages which can be installed by Portage.

> Actually, how did you make portage work with both 2.x and 3.x at the
> same time?

Portage doesn't yet work with Python 3, but it hopefully change soon.

> I would be very interested to know this since afaik no useful program
> can work with both python-3 and python-2 with the same code.

It isn't hard to write code which works with both Python 2.6 and 3.*.

Example:

$ cat get_protocol.py
#!/usr/bin/env python

# It allows to use print() function in 2.6.
from __future__ import print_function

import sys

try:
  # Python 3
  from urllib.parse import urlparse as urllib_parse_urlparse
except ImportError:
  # Python 2
  from urlparse import urlparse as urllib_parse_urlparse

if len(sys.argv) != 2:
  sys.stderr.write("This script requires 1 argument: URL\n")

def get_protocol(url):
  return urllib_parse_urlparse(url)[0]

print("Protocol:", get_protocol(sys.argv[1]))
$ ./get_protocol.py http://www.example.com
Protocol: http

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2009-09-20 17:55 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-19 16:48 [gentoo-dev] Stabilization of Python 3.1 Arfrever Frehtes Taifersar Arahesis
2009-09-19 16:53 ` Dirkjan Ochtman
2009-09-19 17:06 ` Alex Legler
2009-09-19 17:09   ` Dirkjan Ochtman
2009-09-19 17:21     ` Dale
2009-09-19 17:28       ` Olivier Crête
2009-09-19 22:32         ` Dale
2009-09-19 22:41           ` Dawid Węgliński
2009-09-20 14:53             ` Jesús Guerrero
2009-09-20 15:16               ` Dale
2009-09-20 15:24               ` Arfrever Frehtes Taifersar Arahesis
2009-09-20 15:28                 ` Jesús Guerrero
2009-09-20 17:30                 ` Nirbheek Chauhan
2009-09-20 17:57                   ` Arfrever Frehtes Taifersar Arahesis [this message]
2009-09-20 22:15             ` Mark Loeser
2009-09-20 22:47               ` Dale
2009-09-20 11:18         ` Richard Freeman
2009-09-20 14:51           ` Dale
2009-09-19 17:33       ` [gentoo-dev] " Nikos Chantziaras
2009-09-19 17:26     ` [gentoo-dev] " Alex Legler
2009-09-19 18:24       ` AllenJB
2009-09-19 18:20     ` AllenJB
2009-09-19 18:59       ` Arfrever Frehtes Taifersar Arahesis
2009-09-19 19:50         ` Petteri Räty
2009-09-19 20:21           ` Robert Bridge
2009-09-19 23:29             ` Alex Alexander
2009-09-20 10:35               ` Petteri Räty
2009-09-20 20:33                 ` Zac Medico
2009-09-19 22:52       ` [gentoo-dev] " Mark Bateman
2009-09-20 14:44     ` [gentoo-dev] " Jesús Guerrero
2009-09-20 15:46       ` Arfrever Frehtes Taifersar Arahesis
2009-09-20 15:56         ` Nirbheek Chauhan
2009-09-20 16:07           ` Arfrever Frehtes Taifersar Arahesis
2009-09-20 17:25             ` Nirbheek Chauhan
2009-09-20 17:35               ` Arfrever Frehtes Taifersar Arahesis
2009-09-20 17:47                 ` Nirbheek Chauhan
2009-09-20 18:27                   ` Arfrever Frehtes Taifersar Arahesis
2009-09-20 18:46                     ` Nirbheek Chauhan
2009-09-20 19:05                       ` Arfrever Frehtes Taifersar Arahesis
2009-10-08 20:56                       ` Arfrever Frehtes Taifersar Arahesis
2009-09-20 16:51         ` Robert Buchholz
2009-09-20 17:25           ` Arfrever Frehtes Taifersar Arahesis
2009-09-20 22:20             ` Mark Loeser
2009-09-21  1:17               ` Brian Harring
2009-09-21  6:18                 ` [gentoo-dev] " Duncan
2009-09-20 17:10         ` [gentoo-dev] " Petteri Räty
2009-09-19 18:22 ` Tobias Klausmann
2009-09-19 18:51   ` Arfrever Frehtes Taifersar Arahesis
2009-09-20 14:44     ` Jesús Guerrero
2009-09-19 18:45 ` Nirbheek Chauhan
2009-09-19 18:53   ` Arfrever Frehtes Taifersar Arahesis
2009-09-19 19:40     ` Nirbheek Chauhan
2009-09-19 19:35 ` Mark Loeser
2009-09-19 20:47   ` [gentoo-dev] " Ryan Hill
2009-09-19 20:55 ` [gentoo-dev] " Alistair Bush
2009-09-19 23:31   ` [gentoo-dev] " Ryan Hill
2009-09-19 23:45     ` Francesco R
2009-09-20  0:42       ` Alistair Bush
2009-09-20 14:46         ` Francesco R
2009-09-20 14:49   ` [gentoo-dev] " Jesús Guerrero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200909201957.05957.Arfrever@gentoo.org \
    --to=arfrever@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox