Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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; '16,': 0.03; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'url:faqs': 0.09; 'subject:error': 0.11; 'oct': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:r 80': 0.16; 'subject:programming': 0.16; 'subject:random': 0.16; 'url:catb': 0.16; 'url:~esr': 0.16; 'wrote:': 0.17; 'insert': 0.23; 'raise': 0.24; 'random': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'am,': 0.27; 'question': 0.27; 'header:X -Complaints-To:1': 0.28; 'chris': 0.28; 'error': 0.30; 'to:addr :python-list': 0.33; 'something': 0.35; 'received:org': 0.36; 'but': 0.36; 'url:org': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'think': 0.40 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Serhiy Storchaka Subject: Re: how to insert random error in a programming Date: Mon, 15 Oct 2012 20:18:10 +0300 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 37.115.213.25 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 In-Reply-To: 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350321510 news.xs4all.nl 6878 [2001:888:2000:d::a6]:57394 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31323 On 15.10.12 17:04, Chris Angelico wrote: > On Tue, Oct 16, 2012 at 12:55 AM, Debashish Saha wrote: >> how to insert random error in a programming? > > how to ask question good in forumming? > http://www.catb.org/~esr/faqs/smart-questions.html > > But here's one way to do it: > > raise random.choice((OSError,IOError,ZeroDivisionError,UnicodeDecodeError,AssertionError))() I think OP means something like programming[:0] = random.choice((OSError,IOError,ZeroDivisionError,UnicodeDecodeError,AssertionError))()