Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'suppose': 0.05; 'elements.': 0.07; 'subject:based': 0.07; 'python': 0.08; 'doubles': 0.09; 'keys,': 0.09; 'operation,': 0.09; 'seriously.': 0.09; 'syntax.': 0.09; 'received:209.85.210.174': 0.13; 'received :mail-iy0-f174.google.com': 0.13; '"because': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'into.': 0.16; 'shorten': 0.16; 'subject: \n ': 0.16; 'subject:syntax': 0.16; 'syntax': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'yet.': 0.18; 'seconds': 0.21; 'dec': 0.22; 'header:In- Reply-To:1': 0.22; 'unlikely': 0.23; 'code': 0.25; 'message- id:@mail.gmail.com': 0.28; 'second': 0.29; 'pm,': 0.29; 'granted,': 0.30; 'rarely': 0.30; 'tail': 0.30; 'tuples': 0.30; 'chris': 0.30; "i'll": 0.31; 'actual': 0.32; 'idea': 0.32; "can't": 0.32; 'actually': 0.33; 'this.': 0.33; 'there': 0.33; 'to:addr:python-list': 0.34; 'probably': 0.34; 'it.': 0.34; 'rule': 0.34; 'all.': 0.34; 'keys': 0.34; 'operations': 0.35; 'something': 0.35; 'subject:/': 0.35; 'sets': 0.35; '(for': 0.35; 'unless': 0.35; 'optimization': 0.36; '...': 0.36; 'question': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'think': 0.37; 'problems': 0.37; 'could': 0.37; 'using': 0.38; 'references': 0.38; 'steven': 0.38; 'seeing': 0.38; 'received:209.85': 0.38; 'processing': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'difference': 0.40; 'huge': 0.61; 'more': 0.61; 'type': 0.61; '2011': 0.61; 'your': 0.61; 'back': 0.62; 'choose': 0.62; 'cost': 0.63; 'roughly': 0.67; 'challenge': 0.68; 'experts': 0.70; 'hundred': 0.74; 'million': 0.76; 'imagination': 0.84; 'imagined': 0.84; 'strongest': 0.84; 'dozens': 0.91; 'items,': 0.91; 'stupid': 0.91 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=9jkie8DAO73h7jSeiwmUqJABXuy/G8bBEwvtlHBcJ3I=; b=B9pUcY/xTk1EsPvjo+MJnVrxeappGPptOzPkLqzqHAdCtpVrLvUq3o0y6vLb7c3ZNu 5xqIwSV0YUCI+Mb/9tCmier0sSEJ2N3pjmlrjm/0aaQ4vWOeGU4dtAVPek+LAQJ1kMre AM4/HxTELt3WFmmqLW4tpWpEB7ZSsyyqBWONM= MIME-Version: 1.0 In-Reply-To: <4efab65f$0$29973$c3e8da3$5496439d@news.astraweb.com> References: <841f4d29-f50b-4b0b-912b-b497fb6e60ec@t16g2000vba.googlegroups.com> <15424060.724.1324183952802.JavaMail.geo-discussion-forums@prix23> <55f2aab5-be87-460e-8576-645ac225c63d@l19g2000yqc.googlegroups.com> <272d2d13-3168-4991-84ed-57a255a98c10@p9g2000vbb.googlegroups.com> <99ae9ba0-4488-4b77-8e56-cf5af0d594af@cs7g2000vbb.googlegroups.com> <4ef72180$0$29973$c3e8da3$5496439d@news.astraweb.com> <4efa5072$0$29973$c3e8da3$5496439d@news.astraweb.com> <4efab65f$0$29973$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 28 Dec 2011 18:08:37 +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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325056119 news.xs4all.nl 6867 [2001:888:2000:d::a6]:55845 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18106 On Wed, Dec 28, 2011 at 5:25 PM, Steven D'Aprano wrote: > On Wed, 28 Dec 2011 15:06:37 +1100, Chris Angelico wrote: > >> ... suppose you have a huge >> set/frozenset using tuples as the keys, and one of your operations is to >> shorten all keys by removing their first elements. Current Python >> roughly doubles the cost of this operation, since you can't choose what >> type the tail is made into. > > The First Rule of Program Optimization: > - Don't do it. > > The Second Rule of Program Optimization (for experts only): > - Don't do it yet. > > > Building syntax to optimize imagined problems is rarely a good idea. The > difference between 2 seconds processing your huge set and 4 seconds > processing it is unlikely to be significant unless you have dozens of > such huge sets and less than a minute to process them all. > > And your idea of "huge" is probably not that big... it makes me laugh > when people ask how to optimize code "because my actual data has HUNDREDS > of items!". Whoop-de-doo. Come back when you have a hundred million > items, then I'll take your question seriously. > > (All references to "you" and "your" are generic, and not aimed at Chris > personally. Stupid English language.) And what you're seeing there is the _best possible_ situation I could think of, the strongest possible justification for new syntax. Granted, that may say more about me and my imagination than about the problem, but the challenge is open: Come up with something that actually needs this. ChrisA