Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'syntax': 0.04; 'subject:Python': 0.06; 'float': 0.07; 'difference,': 0.09; 'parameter': 0.09; 'senses': 0.09; 'python': 0.11; 'def': 0.12; '(both': 0.16; '-tkc': 0.16; 'clashes': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'function),': 0.16; 'int)': 0.16; 'overloaded': 0.16; 'received:174.136': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'module': 0.19; 'import': 0.22; 'header:In- Reply-To:1': 0.27; "d'aprano": 0.31; 'minor': 0.31; 'steven': 0.31; 'could': 0.34; 'except': 0.35; 'but': 0.35; 'charset:us- ascii': 0.36; 'list': 0.37; 'received:10': 0.37; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'name': 0.63; 'skip:n 10': 0.64; 'invalid': 0.68; 'apart': 0.72; 'subject:Solution': 0.84; 'subject:Proposal': 0.91 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1422103509166:2641747249 X-MC-Ingress-Time: 1422103509166 Date: Sat, 24 Jan 2015 06:47:03 -0600 From: Tim Chase To: python-list@python.org Subject: Re: Python Sanity Proposal: Type Hinting Solution In-Reply-To: <54c339d7$0$13005$c3e8da3$5496439d@news.astraweb.com> References: <6da1eb58-a0bb-4d37-8293-0a8cafe6a89c@googlegroups.com> <54c1e349$0$12975$c3e8da3$5496439d@news.astraweb.com> <54c339d7$0$13005$c3e8da3$5496439d@news.astraweb.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AuthUser: tim@thechases.com 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422103514 news.xs4all.nl 2906 [2001:888:2000:d::a6]:44936 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84462 On 2015-01-24 17:21, Steven D'Aprano wrote: > # Cobra > def sqroot(i as int) as float > > # Python > def sqroot(i:int)->float: > > > Cobra's use of "as" clashes with Python. In Python, "as" is used for > name-binding: > > import module as name > with open('file') as f > except Exception as e > > but apart from that minor difference, they're virtually identical. Though given that def sqrt(i as int) as float: is invalid Python syntax (both in the parameter list and as the return value of the function), the meaning of "as" could be overloaded in both senses to allow for the Cobra-like syntax. -tkc