Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.01; 'compile- time': 0.07; 'compiler': 0.07; 'subject:based': 0.07; 'python': 0.08; 'chose': 0.09; 'am,': 0.12; 'exception': 0.12; 'def': 0.13; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; 'argument': 0.15; "'type": 0.16; 'declaration': 0.16; 'derailing': 0.16; 'executed,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'germane': 0.16; 'identifier': 0.16; 'nature,': 0.16; 'normally.': 0.16; 'pops': 0.16; 'run-time.': 0.16; 'subject: \n ': 0.16; 'subject:syntax': 0.16; 'unpacking': 0.16; 'whatsoever': 0.16; 'work."': 0.16; 'meant': 0.17; 'wrote:': 0.18; 'shape': 0.19; 'dec': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; '"this': 0.24; 'code': 0.25; 'function': 0.27; 'fix': 0.27; 'raise': 0.28; 'message-id:@mail.gmail.com': 0.28; '27,': 0.29; 'affected': 0.29; 'compile': 0.29; 'module.': 0.29; 'error': 0.29; 'example': 0.29; 'correct': 0.29; 'handling': 0.30; 'again?': 0.30; 'checking.': 0.30; 'confusion': 0.30; "it'd": 0.30; 'silence': 0.30; 'threads': 0.30; 'chris': 0.30; 'error.': 0.32; 'tue,': 0.32; "won't": 0.33; 'actually': 0.33; 'there': 0.33; 'object': 0.33; 'to:addr:python-list': 0.34; 'it.': 0.34; 'checking': 0.34; 'all.': 0.34; 'anything': 0.34; 'forces': 0.34; 'something': 0.35; 'subject:/': 0.35; 'apply': 0.35; 'however,': 0.36; 'file': 0.36; 'starting': 0.36; 'problem.': 0.36; 'thread': 0.37; 'but': 0.37; 'run': 0.37; 'list,': 0.37; 'received:google.com': 0.37; 'could': 0.37; 'received:209.85': 0.38; 'put': 0.38; 'ways': 0.39; "it's": 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'might': 0.40; 'type': 0.61; '2011': 0.61; 'matter': 0.61; 'your': 0.61; 'course,': 0.62; 'applying': 0.62; 'apologize': 0.63; 'further': 0.64; 'here': 0.65; '26,': 0.67; 'designers': 0.67; 'refuse': 0.67; 'luck': 0.68; 'collection': 0.69; 'instant': 0.74; 'failure': 0.74; 'have.': 0.77; 'certain,': 0.84; 'circumstance': 0.84; 'constraint': 0.84; 'refuses': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=MAiAXRiwCIiw3XxTfi8T2fenS4zlWkrup6qT5HmLhuI=; b=lnJnEpV4xyQNZ6bCadN4XUxPIoxNozajjayxBy5cFz4KePifZRlLbTkJYe/to37r7Z e8WyvAEXnKDpmPRDjmnsYq4iteuXrQlwLVzsNpkIqwY9VodOVhs+aBlFuatxgcQen4lW 9cP5Hy9TkizYX0qbw37bRLubX383pnUrGaVTg= MIME-Version: 1.0 In-Reply-To: <82fd3bec-5afa-4e87-ae9a-8f93ecb9e366@dp8g2000vbb.googlegroups.com> References: <841f4d29-f50b-4b0b-912b-b497fb6e60ec@t16g2000vba.googlegroups.com> <298b28e6-b8c9-43e1-8c90-cf0d7654fe68@y12g2000vba.googlegroups.com> <56f0073e-e259-4a9d-bd3a-1221fd74c5b1@d8g2000vbb.googlegroups.com> <7191d569-5036-4800-b7a3-fcacb000de94@d10g2000vbk.googlegroups.com> <930f748a-db7c-4ecc-9627-a3ab2647ae65@o14g2000vbo.googlegroups.com> <4ef72149$0$29973$c3e8da3$5496439d@news.astraweb.com> <457ebc8f-bb87-4005-b527-2fe6c02250c8@m7g2000vbc.googlegroups.com> <14c228af-0de5-448f-b617-832173aa6cba@p4g2000vbt.googlegroups.com> <82fd3bec-5afa-4e87-ae9a-8f93ecb9e366@dp8g2000vbb.googlegroups.com> Date: Tue, 27 Dec 2011 09:37:06 +1100 Subject: Re: Pythonification of the asterisk-based collection packing/unpacking syntax From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 57 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1324939029 news.xs4all.nl 6988 [2001:888:2000:d::a6]:40948 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17987 On Tue, Dec 27, 2011 at 9:12 AM, Eelco wrote: > On Dec 26, 10:05=A0pm, Chris Angelico wrote: >> A constraint can be applied at compile time or at run time. It'd be >> valid to apply them at edit time, if you so chose - your editor could >> refuse to save your file until you fix the problem. Doesn't mean a >> thing. > > A constraint in the sense that I have explained many times now, can in > no way, shape or form be applied at run time. Youd have better luck > applying a consternation to a squirrel. Perhaps you meant 'type check' > again? But then again, that makes no sense whatsoever at compile- > time... Im starting to doubt if there is any sense to be found here at > all. A constraint failure causes an error at the time it's discovered. 1) Your editor pops up a message the instant you type something with such an error, and forces you to correct it before going on. 2) Your compiler refuses to produce byte-code for the module. 3) When the line of code is executed, an exception is thrown. All of these are valid ways of handling a constraint. Here is a Python example of a type constraint: def foo(arg): if not isinstance(arg,list): raise "This won't work." If you call it with something that's not a list, you get an error. Call it with a list, and execution continues normally. That's a constraint. Of course, it might not be a _type_ constraint: def foo(arg): if arg>5: raise "This won't work either." # and yes, that's oddly truer in Python 3 (Aside: In Pike, I can actually put that into a type constraint (declare the argument to be int(5..) for instance). This, however, is not germane to the conversation.) > Anyway, ill take your further silence on the matter as a 'sorry I > derailed your thread with my confusion of terminology' Like Mary Poppins, I never apologize for derailing threads :) >> Python, by its nature, cannot do compile-time type checking. > > Python can do whatever its designers have put into it. In this case, > that includes the emission of different code based on a (type) > annotation at the point of declaration of an identifier (only in the > particular circumstance of collection unpacking though, as far as I am > aware). Of course, but how can Python, without a completely different structure, do compile-time checking of object types? Everything can be monkey-patched at run-time. Anything could be affected by any function call. It's impossible to say for certain, at compile time, what data type anything will have. ChrisA