Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.01; 'python.': 0.04; 'names.': 0.07; 'received:verizon.net': 0.07; 'statically': 0.07; 'terry': 0.07; 'whatever.': 0.07; 'python': 0.08; 'annotations': 0.09; 'necessary,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:python': 0.10; 'typing': 0.15; '1:13': 0.16; 'reedy': 0.16; 'subset': 0.16; 'subject:question': 0.17; 'language': 0.17; 'wrote:': 0.18; 'jan': 0.19; 'header:In-Reply-To:1': 0.22; 'extent': 0.24; 'code': 0.25; 'code.': 0.26; 'variable': 0.28; 'compile': 0.29; 'explicitly': 0.29; 'sean': 0.29; 'theoretical': 0.29; 'pm,': 0.29; 'closer': 0.30; 'compromise': 0.30; 'types.': 0.30; 'objects': 0.32; 'header :User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'there': 0.33; 'to:addr:python-list': 0.34; 'changing': 0.35; 'similar': 0.36; 'question': 0.36; 'subject:skip:p 10': 0.37; 'received:org': 0.38; 'option': 0.39; 'being': 0.39; 'strong': 0.39; 'to:addr:python.org': 0.40; 'type': 0.61; 'types': 0.61; 'our': 0.64; 'casting': 0.84; 'compiles': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: python philosophical question - strong vs duck typing Date: Tue, 03 Jan 2012 15:38:17 -0500 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-74-109-121-73.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: 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: 1325623116 news.xs4all.nl 6938 [2001:888:2000:d::a6]:35353 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18450 On 1/3/2012 1:13 PM, Sean Wolfe wrote: > I have a theoretical / philosophical question regarding strong vs duck > typing in Python. Let's say we wanted to type strongly in Python and Python objects are strongly typed, in any sensible meaning of the term. What you mean is statically or explicitly typing names. > were willing to compromise our code to the extent necessary, eg not > changing variable types or casting or whatever. Let's say there was a > methodology in Python to declare variable types. > > The question is, given this possibility, would this get us closer to > being able to compile down to a language like C or C++? Cython compiles Python as is to C. It also gives the option to add type annotations to names to get faster code. Shredskin compiles a subset of Python, or a subset of usages, to C, with similar benefits. -- Terry Jan Reedy