Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'assign': 0.07; 'variables': 0.07; '"if': 0.09; 'methods,': 0.09; 'runtime': 0.09; 'system;': 0.09; 'type;': 0.09; 'cc:addr:python-list': 0.11; "wouldn't": 0.14; 'declaration': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'namedtuple': 0.16; 'object()': 0.16; 'optional': 0.16; 'specifying': 0.16; 'subject:programming': 0.16; 'language': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'bit': 0.19; 'rules': 0.22; 'cc:addr:python.org': 0.22; 'certainly': 0.24; 'lets': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'catching': 0.31; 'tuples': 0.31; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'are,': 0.36; 'possible': 0.36; 'too': 0.37; 'two': 0.37; 'convention': 0.38; 'rather': 0.38; 'does': 0.39; 'days': 0.60; 'then,': 0.60; "you're": 0.61; 'name': 0.63; 'field': 0.63; 'mar': 0.68; 'anything.': 0.68; 'registers': 0.68; 'records': 0.73; 'coupled': 0.84; "it'd": 0.84; 'weaker': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=xsHnZzQgxy6snSZ6Go++C98nNWKInqLWFrkV9p52pGs=; b=GnsltxsdaFoRAXFQ28Ln+D5CMNcSM3KSQeLpIr7MLGCCKyX+opM6YZ5YYYRNtCv+qK aGIsOFqNIzoQodgRX1gsnuRCzzFPEy5MGVqSCEygkAWrc40vUhVzf69UJ4KTDvXaY43y 5HkQ1KG/NXt4I4aufSqCLRP5XCHHoeMRESjmZ5Gsg6kIwO4+MwUly+FUEfgCcE0BnHDi 2lVUqSNIRZEALwyAQjOKBWuqBsr4JUHGyZGIJEEmWY98M3I1bl64N/aOsmpImu77YmSP ogu18Znukfr3LXLkEbMc8lH2VmgN1HOsjYvpTAR0os0L2NfuD6G4ez8ZPUa7mvYoMwI6 nwpQ== MIME-Version: 1.0 X-Received: by 10.66.118.71 with SMTP id kk7mr6265652pab.14.1393940874888; Tue, 04 Mar 2014 05:47:54 -0800 (PST) In-Reply-To: References: <4c7dbc57-eef9-4582-aecd-aac13a39b45f@googlegroups.com> <3b54a279-03a1-4a81-a428-ecad6eb16036@googlegroups.com> <216bb5f4-32c4-4f86-a9f4-1b0dd37a2a81@googlegroups.com> <0129a5b9-b85f-4ad5-b5e2-bfb2a48041d5@googlegroups.com> <5314bb96$0$29985$c3e8da3$5496439d@news.astraweb.com> <5315661c$0$2923$c3e8da3$76491128@news.astraweb.com> <53159540$0$2923$c3e8da3$76491128@news.astraweb.com> Date: Wed, 5 Mar 2014 00:47:54 +1100 Subject: Re: Functional programming From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393940878 news.xs4all.nl 2829 [2001:888:2000:d::a6]:60727 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67675 On Wed, Mar 5, 2014 at 12:30 AM, BartC wrote: > But declaring variables is not just about specifying a type; it registers > the name too so that misspelled names can be picked up very early rather > than at runtime (and that's if you're lucky). The two are separate. I don't know of any language that lets you declare a type without catching the names, but there's certainly the other way around (ECMAScript just has "var x, y, z"). It'd be theoretically possible to have a Python-style "variable inference" system (if I can call it that - the rules of "if you assign to it and don't declare it as global/nonlocal, it's local") coupled with an optional type declaration system; if you don't declare, then it can hold anything. I just don't know of any language that does it. >> That convention is a bit weaker these days than it used to be. Tuples now >> have list-like methods, and we have namedtuple for record/struct-like >> objects with named fields. > > (Aren't tuples immutable? They wouldn't work well for records then, because > it would be impossible to change a field of a record.) They are, including namedtuples. But an object() can be used that way, if you want. ChrisA