From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 1BC68138825 for ; Mon, 10 Nov 2014 20:33:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D9366E086C; Mon, 10 Nov 2014 20:33:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1EF81E0851 for ; Mon, 10 Nov 2014 20:33:04 +0000 (UTC) Received: from [10.0.10.112] (unknown [195.254.219.2]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: bernalex) by smtp.gentoo.org (Postfix) with ESMTPSA id 2254F34016B for ; Mon, 10 Nov 2014 20:33:01 +0000 (UTC) Message-ID: <546120FA.9060305@gentoo.org> Date: Mon, 10 Nov 2014 21:32:58 +0100 From: Alexander Berntsen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.8.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [PATCH] unprivileged mode: generate PORTAGE_DEPCACHEDIR References: <1415575480-19505-1-git-send-email-zmedico@gentoo.org> <54609D06.5020101@gentoo.org> <54610217.3080707@gentoo.org> In-Reply-To: <54610217.3080707@gentoo.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Archives-Salt: ab4a59ab-be5e-42ec-886a-2c7423e15d50 X-Archives-Hash: 862ad556d5aa06b659060efd9844d623 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 10/11/14 19:21, Zac Medico wrote: > Well, you'll have to clarify what's so "terrible" about it. Note that I didn't > use os.path.isdir or similar because those functions hide all kinds of relevant > exceptions, such as EACCES. I wish there were a more declarative way of expressing this in Python. It's extremely imperative. > If it's the continue and break that upset you, we can do it like this: > > found_dir = False > while current_dir != os.sep and not found_dir: > try: > os.stat(current_dir) > found_dir = True > except OSError: > if errno == errno.ENOENT: > current_dir = \ > os.path.dirname(current_dir) > else: > found_dir = True That's a little better -- I'd prefer that. Thanks. - -- Alexander bernalex@gentoo.org https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlRhIPkACgkQRtClrXBQc7WTpQD7BYE1+KdV8XG4h0JghIJ/dP4v 17isaVatmFdoSQdtwEsA/RXXK33wyWxR4yN0HDENtU5peRJPU/u/eRA/lobm31j9 =jLaK -----END PGP SIGNATURE-----