Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.01; 'compile- time': 0.07; 'subject:based': 0.07; 'chose': 0.09; 'runtime': 0.09; 'url:msdn': 0.09; 'am,': 0.12; 'received:209.85.210.174': 0.13; 'received:mail-iy0-f174.google.com': 0.13; "'type": 0.16; 'error"': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'justify': 0.16; 'nature,': 0.16; 'subject: \n ': 0.16; 'subject:syntax': 0.16; 'syntactic': 0.16; 'wrote:': 0.18; 'dec': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'fix': 0.27; 'message-id:@mail.gmail.com': 0.28; '27,': 0.29; 'compile': 0.29; "skip:' 30": 0.29; 'checking.': 0.30; "it'd": 0.30; 'semantics': 0.30; 'url:library': 0.31; 'does': 0.32; 'tue,': 0.32; 'to:addr:python-list': 0.34; 'something': 0.35; 'google': 0.35; 'subject:/': 0.35; 'apply': 0.35; 'however,': 0.36; 'file': 0.36; 'problem.': 0.36; '...': 0.36; 'run': 0.37; 'received:google.com': 0.37; 'could': 0.37; 'using': 0.38; 'some': 0.38; 'received:209.85': 0.38; 'goes': 0.39; 'hit': 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'url:microsoft': 0.40; 'type': 0.61; '2011': 0.61; 'types': 0.61; 'your': 0.61; 'kind': 0.61; 'kinds': 0.64; 'here': 0.65; 'refuse': 0.67; 'url :en-us': 0.71; 'constraint': 0.84; 'contrast,': 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; bh=OIZu+1dnunnAO1PANNlIhBhu19usSzJg/FV3wTlASdY=; b=dR396sNWP4KQnI6F0XL2q5IEdNZsOTjKqncsiffm94YqKpbQXCETGsYk3jaMIQ9rwA DE9zC8d0YT2jeHOC7EuFeV10IaDA6yGHqVk0Lc17OiJUUwr5TciGe5yKQoNV/x69No4w 2kHkZq9OIKejrA/CAwAppnYP1efLJb4IHbJ90= MIME-Version: 1.0 In-Reply-To: <14c228af-0de5-448f-b617-832173aa6cba@p4g2000vbt.googlegroups.com> References: <841f4d29-f50b-4b0b-912b-b497fb6e60ec@t16g2000vba.googlegroups.com> <15424060.724.1324183952802.JavaMail.geo-discussion-forums@prix23> <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> Date: Tue, 27 Dec 2011 08:05:18 +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 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1324933521 news.xs4all.nl 6927 [2001:888:2000:d::a6]:41900 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17981 On Tue, Dec 27, 2011 at 7:58 AM, Eelco wrote: > What you are talking about goes by the name of a 'dynamic type CHECK'; > some kind of syntactic sugar for something like > 'assert(type(obj)==sometype)'. Like a 'type cast', this is also a > runtime concept... > > By contrast, here is the first google hit for 'type constraint'. > > http://msdn.microsoft.com/en-us/library/d5x73970.aspx > > "...you can apply restrictions to the kinds of types ... by using a > type that is not allowed by a constraint, the result is a COMPILE-TIME > ERROR" (emphasis mine) 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. Python, by its nature, cannot do compile-time type checking. Under no circumstances, however, does this justify the use of the term "constraint" to mean "utterly different semantics of the same code". ChrisA