Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.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; 'from:addr:yahoo.co.uk': 0.04; 'syntax': 0.04; 'argument': 0.05; 'interpreter': 0.05; 'subject:Python': 0.06; 'decorator': 0.09; 'expected.': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.12; 'bug': 0.12; 'language.': 0.14; '24,': 0.16; 'bool': 0.16; 'email name:"': 0.16; 'fuzzy': 0.16; 'hint:': 0.16; 'hurts': 0.16; 'int)': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'separated': 0.16; 'string:': 0.16; 'ignore': 0.16; 'language': 0.16; 'wrote:': 0.18; 'normally': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'decorators': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'point': 0.28; 'function': 0.29; 'skip:@ 10': 0.30; "d'aprano": 0.31; 'ordinary': 0.31; 'steven': 0.31; 'johnson': 0.35; 'but': 0.35; 'doubt': 0.36; 'error.': 0.37; 'january': 0.37; 'wrong': 0.37; 'being': 0.38; 'thank': 0.38; 'to:addr:python-list': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'hope': 0.61; 'our': 0.64; 'charset:windows-1252': 0.65; 'between': 0.67; '2015': 0.84; 'around,': 0.84; 'complexity': 0.84; 'distinguish': 0.84; 'have?': 0.84; 'parser,': 0.84; 'silently': 0.84; 'subject:Solution': 0.84; 'genius': 0.91; 'subject:Proposal': 0.91; 'write:': 0.91; 'hair': 0.93; 'rick': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Python Sanity Proposal: Type Hinting Solution Date: Sat, 24 Jan 2015 17:36:06 +0000 References: <6da1eb58-a0bb-4d37-8293-0a8cafe6a89c@googlegroups.com> <5afad59b-5e8c-4821-85cf-9e971c8c7be6@googlegroups.com> <4b3b498a-c9b0-443d-8514-87ccd8e98f43@googlegroups.com> <54c39e48$0$12996$c3e8da3$5496439d@news.astraweb.com> <7db16477-1dd6-4f93-adfe-54f7b7a690b2@googlegroups.com> <54c3d5d0$0$12977$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-92-24-222-48.ppp.as43234.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: <54c3d5d0$0$12977$c3e8da3$5496439d@news.astraweb.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: 58 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422120987 news.xs4all.nl 2854 [2001:888:2000:d::a6]:36531 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84480 On 24/01/2015 17:26, Steven D'Aprano wrote: > Rick Johnson wrote: > >> On Saturday, January 24, 2015 at 7:30:02 AM UTC-6, Steven D'Aprano wrote: >>> [...] It requires extra complexity to the parser, so that >>> decorators may be separated from the function by a hint: >>> >>> @decorate >>> "@typehint: (str, int) -> bool" >>> def myfunction(arg1, arg2): >>> >>> No doubt some people will get them the wrong way around, >>> and the type checker may silently ignore their hints: >>> >>> "@typehint: (str, int) -> bool" >>> @decorate >>> def myfunction(arg1, arg2): >>> >>> And others will write: >>> >>> @decorate >>> @typehint(str, int) -> bool >>> def myfunction(arg1, arg2): >>> >>> >>> and be annoyed or perplexed by the syntax error. >>> >>> Some syntax will be a bug magnet. This is one. >> >> Your argument is weak here. If the interpreter cannot >> distinguish between "@typehint ..." and "@ ..." > > Thank you for demonstrating my point for me. > > The difference is not > > @typehint(...) > def func(...): > > versus any other decorator, but the STRING: > > "@typehint(...)" > > being used where a decorator would normally be expected. > > If a genius of the degree like Rick can be fooled, what hope do ordinary > mortals have? > So Rick is having a bad hair day, hence using fuzzy logic? Ooh, that one is so bad even my stomach hurts :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence