Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'operator': 0.03; 'skip:[ 20': 0.03; 'subject:Python': 0.05; 'incompatible': 0.07; '22,': 0.09; 'formatted': 0.09; 'integers': 0.09; 'itself,': 0.09; 'modulo': 0.09; 'received:mail- vb0-f46.google.com': 0.09; 'splitting': 0.09; 'sure,': 0.09; 'tuple': 0.09; '"this': 0.13; 'language': 0.14; 'dec': 0.15; 'result.': 0.15; 'sat,': 0.15; '"g"': 0.16; '10:05': 0.16; 'child.': 0.16; 'division,': 0.16; 'division.': 0.16; 'formatting,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'instance:': 0.16; 'operator.': 0.16; 'parts,': 0.16; 'worst': 0.16; 'string': 0.17; 'wrote:': 0.17; 'certainly': 0.17; 'integer': 0.17; 'mathematical': 0.17; "shouldn't": 0.17; 'string,': 0.17; 'received:209.85.212.46': 0.18; 'appropriate': 0.20; 'equivalent': 0.20; 'bit': 0.21; 'either.': 0.22; 'names.': 0.22; "i'd": 0.22; 'somebody': 0.23; 'this:': 0.23; "haven't": 0.23; 'header:In-Reply-To:1': 0.25; 'possibly': 0.27; 'message- id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'received:209.85.212': 0.28; 'chris': 0.28; "d'aprano": 0.29; 'equality': 0.29; 'prints': 0.29; 'steven': 0.29; 'strings,': 0.29; "we're": 0.30; 'connection': 0.30; 'sense': 0.31; 'point': 0.31; '(and': 0.32; 'could': 0.32; 'print': 0.32; 'skip:s 30': 0.33; 'done,': 0.33; 'programming,': 0.33; 'text,': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'similar': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'add': 0.36; 'except': 0.36; 'but': 0.36; 'bad': 0.37; 'itself': 0.37; 'does': 0.37; 'why': 0.37; 'quite': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'description': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'easy': 0.60; 'relationship': 0.60; 'between': 0.63; 'close': 0.63; 'different': 0.63; 'ever': 0.63; 'show': 0.63; 'taking': 0.65; 'learned': 0.65; 'connection.': 0.75; '"oh,': 0.84; 'inherent': 0.84; 'presumably': 0.84; 'spell': 0.91 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:to :content-type; bh=A1h6U0LqVJuqHWqvHH/eMtbnImYZuCcmHvD8nV4gaj4=; b=ePgo9+Dn34py8tRNoLzhzCtB7mVm6EcoGd0lZFSW9hzynWtMf2aKXkmNSq56b/lbvG 3MftpJiFSXGI0tMMOKxKwXnsIxPuLvJcedMAXTtgpz36rMOKI2suLw+MLlDmkN2vS3rJ 4cBMX9onuHiP8Bkw+OketLW2ABWTkoU/RbMKOkCWyEaE6+4nJZEPbCWf3GnzMqpPu7k2 D+ISKWLrzUg9sLyR0c8ncDoH28wkcjqRpT9CowZ5kxqEKh/BmgwIsInchv8EGZ1Rephi kZtN6h26/ylLdxLEKtvP/YrcNQ/gqhJCMHBKUUJ2WhjLyCYrHf9ARjKq4LBZdBzX8E6j Yb2w== MIME-Version: 1.0 In-Reply-To: <50d593e1$0$29967$c3e8da3$5496439d@news.astraweb.com> References: <96edb672-dabd-4ab8-9e7c-3fa7f4a91437@googlegroups.com> <44335f22-555a-4806-b24a-7d4cb1d8e529@googlegroups.com> <4ddee631-b5b5-4cb4-82b0-00ca403b773e@googlegroups.com> <30bf668f-56e5-482f-b540-5cfa136348d1@googlegroups.com> <62459a43-88e7-4619-9742-a88021bb06ee@googlegroups.com> <50d593e1$0$29967$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 22 Dec 2012 23:11:00 +1100 Subject: Re: Brython - Python in the browser 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.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: 68 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1356178264 news.xs4all.nl 6943 [2001:888:2000:d::a6]:45629 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35356 On Sat, Dec 22, 2012 at 10:05 PM, Steven D'Aprano wrote: > On Sat, 22 Dec 2012 20:08:25 +1100, Chris Angelico wrote: > >> I don't see "string % tuple" as a good syntax; I prefer to spell it >> sprintf("format",arg,arg,arg). > > Very possibly one of the worst names ever from a language that excels at > bad names. "Sprint f"? WTF? > > Certainly not appropriate for Python, where a sprintf equivalent would > return a new string, rather than automatically print the result. Oh > wait... C's sprintf doesn't automatically print either. > > *wink* Sure, it's not ideal, but it's the string-returning form of printf, which prints formatted text, so it's not completely inappropriate. But my point stands: it's an easy thing to search for. >> When it >> comes to operators on strings, what I'd prefer to see is something that >> does more-or-less what the operator does with integers - for instance: >> >> "This is a string" / " " ==> ["This","is","a","string"] > > I don't see the connection between the above and numeric division. If it > were this: > > "This is a string" / 3 ==> ["This ", "is a ", "strin", "g"] > > (and presumably // 3 would be the same except the "g" would be dropped) > then I could see the connection. But there's no relationship between > numeric division, which divides a number up into N equal-sized parts, and > string splitting as you show above. Sure, but it's still dividing. It's a different form of division, but it still makes sense. "Oh, you're dividing that string by a delimiter. I'd prefer to call it 'on' a delimiter, but 'by' works." Your description makes perfectly good sense too, though; however, if: "This is a string" / 3 ==> ["This ", "is a ", "strin", "g"] and "This is a string" // 3 ==> ["This ", "is a ", "strin"] then "This is a string" % 3 ==> ["g"] or possibly "g" which is incompatible with current usage. But that's a meaning that makes reasonable sense as "modulo". >> Taking a string modulo a tuple doesn't make any sense in itself, > > Taking an integer cross an integer doesn't make any sense if you haven't > learned the meaning of the + operator. Why insist that only string > operators must make inherent sense to somebody who doesn't know what the > operator means? If we're allowed to learn the meaning of + * and &, why > not % as well? Sure, but + and * have meaning in mathematics, not just programming, and it's a similar meaning. Even the much-maligned = assignment, which has quite a different meaning to = equality, which itself isn't the same as the = equality in mathematics, is sufficiently close that it's grokkable. But someone coming from a mathematical background has no particular advantage in figuring out that % means formatting, or that <= means add child. That doesn't mean they shouldn't be done, just that the justification hump is that bit higher. ChrisA