Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!eweka.nl!hq-usenetpeers.eweka.nl!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'interpreter': 0.04; 'attribute': 0.05; 'cpython': 0.05; 'subject:file': 0.07; 'try:': 0.07; 'python': 0.09; 'ioerror:': 0.09; 'sep': 0.09; 'underlying': 0.09; 'bug': 0.10; 'cc:addr :python-list': 0.10; 'subject:python': 0.11; '24,': 0.16; 'benjamin': 0.16; 'cc:name:python list': 0.16; 'coupling': 0.16; 'subject:API': 0.16; 'syntax.': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'bit': 0.21; 'exceptions': 0.22; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'argue': 0.29; 'implicitly': 0.29; 'overhead': 0.29; 'class': 0.29; 'this.': 0.29; "i'm": 0.29; 'error': 0.30; 'code': 0.31; 'received:209.85.160.46': 0.32; 'raising': 0.33; 'operations': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'except': 0.36; 'but': 0.36; 'should': 0.36; 'operating': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'little': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'free': 0.61; 'between': 0.63; 'more': 0.63; 'direct': 0.69; 'special': 0.73; 'bypasses': 0.84; 'oscar': 0.84; 'prone': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=DC0NbdAez35ouQyydAODh1cKWowXVx0MkvkJfUu97Ho=; b=vhrce9cE3UHrpsOIQRqF95uQJ32PlOhtZEDN18n52vEn6/NM5o8j+lCDbwHe6lS4mC Fd1zKN8NKMABY+Rk8TXnWynFQ/B27Ii53C4IcfNXoE+LkYZlCNjAapbGVJcoby5mmOos 7pYN1pJneZFDvykxQw0lRsNf80W93BT2Ba7cZGBeQHTnuhdxiXbWMRJ8LPBr62hMMxro 8ZpUBLHwFJCsuXO/IjuhImHF76XjHPfVLbetvcuoESB9BWyu9rjektS+gILZxQk3nX++ r607nkuxihm80nKX96Nvpv88yeD+ngFWeG6AUXXfRI5PXJfH6jqaXBdFwprlsAoOffGC M6LA== MIME-Version: 1.0 In-Reply-To: References: <0ec1fe2e-890c-4e25-8047-4cb8bee0aa95@googlegroups.com> <5060D55C.3000407@davea.name> Date: Mon, 24 Sep 2012 21:32:42 -0500 Subject: Re: python file API From: Mark Adam To: Oscar Benjamin Content-Type: text/plain; charset=ISO-8859-1 Cc: Python List X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348540365 news.xs4all.nl 6852 [2001:888:2000:d::a6]:51080 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29999 On Mon, Sep 24, 2012 at 5:55 PM, Oscar Benjamin wrote: > There are many situations where a little bit of attribute access magic is a > good thing. However, operations that involve the underlying OS and that are > prone to raising exceptions even in bug free code should not be performed > implicitly like this. I find the following a little cryptic: > try: > f.pos = 256 > except IOError: > print('Unseekable file') Well it might be that the coupling between the python interpreter and the operating system should be more direct and there should be a special exception class that bypasses the normal overhead in the CPython implementation so that error can be caught in the code without breaking syntax. But I don't think I'm ready to argue that point.... markj