Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed2.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'languages,': 0.04; 'subject:Python': 0.06; 'plenty': 0.07; 'skip:" 60': 0.07; 'string': 0.09; 'filename': 0.09; 'mess': 0.09; 'sure,': 0.09; 'windows,': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; 'assume': 0.14; '2.7': 0.14; '(it': 0.16; 'easier.': 0.16; 'fine.': 0.16; 'foot': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'interpreter,': 0.16; 'repr': 0.16; 'roy': 0.16; 'strftime': 0.16; 'prevent': 0.16; 'thursday,': 0.16; ':-)': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'form:': 0.24; '(or': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'equivalent': 0.26; 'header :In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'absolute': 0.30; 'involving': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'easier': 0.31; '>>>>': 0.31; 'shoot': 0.31; "user's": 0.31; 'file': 0.32; 'probably': 0.32; 'stuff': 0.32; 'worked': 0.33; 'fri,': 0.33; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'could': 0.34; 'no,': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'done': 0.36; "didn't": 0.36; 'useful': 0.36; 'january': 0.37; 'being': 0.38; 'system,': 0.38; 'process,': 0.38; 'question,': 0.38; 'whatever': 0.38; 'anything': 0.39; 'ability': 0.39; 'realize': 0.39; 'users': 0.40; 'simply': 0.61; "you're": 0.61; 'provide': 0.64; 'here': 0.66; 'smith': 0.68; 'fact,': 0.69; 'goal': 0.75; 'lack': 0.78; 'yourself': 0.78; '3.4': 0.84; 'everything.': 0.84; 'loser': 0.84; 'convenience,': 0.91; 'cutting': 0.91; '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=ljsQhkYBjUkf1ELR4EUbxiaYUhxuUjUV5YvF5ECrWFQ=; b=G/PiYwRQ2YMAWxkl4ctEIOdpPPHT0nX0YKlNTSBOVsaL+n601qreqJpS+1bB/t2LHl 3a/pAQbxGh0escVYMzwegmcKf4dUAubMvg3g6fcEbJTQRWP+dzqYOaOgQ/h3hHk9v/LL mUZ8HcemEn0IXUfKXjngUcRKvx6a+QVD0cI9qIdfN0iOrs3Pql4CKmU61tOHIQc8reuH YV12iCXeIjFCR4yVO7Va6FYVShlIEMsfUKtF7xXpvtpUg5USEMwj0gnVtFfacmJoDnv8 5ybbmg+wcIRO7GhWln0h3GZqY/g6B4q5F3w0Nw1HorOjZAhOgKVMHfDR2O4ibczdxdTZ eLcA== MIME-Version: 1.0 X-Received: by 10.66.163.36 with SMTP id yf4mr6244338pab.67.1389301947272; Thu, 09 Jan 2014 13:12:27 -0800 (PST) In-Reply-To: <9b9c51df-8c1d-43e8-a3da-41b879238a7b@googlegroups.com> References: <4b702$52cc262e$541826b9$22985@cache80.multikabel.net> <4cbf$52cc2e82$541826b9$11761@cache70.multikabel.net> <686$52cd4640$541826b9$21896@cache1.tilbu1.nb.home.nl> <52CE3416.9090501@stoneleaf.us> <7wiottej72.fsf@benfinney.id.au> <82fa7f62-9625-41cc-8d1f-c87c0e51cb47@googlegroups.com> <9b9c51df-8c1d-43e8-a3da-41b879238a7b@googlegroups.com> Date: Fri, 10 Jan 2014 08:12:27 +1100 Subject: Re: the Gravity of Python 2 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: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1389301951 news.xs4all.nl 2921 [2001:888:2000:d::a6]:60316 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63637 On Fri, Jan 10, 2014 at 7:54 AM, Roy Smith wrote: > On Thursday, January 9, 2014 3:35:05 PM UTC-5, Chris Angelico wrote: >> In fact, I've given end users the ability to enter strftime strings (eg >> to construct a filename), and it's worked just fine. > > I assume you realize that "../../../../../../../../../../../../../../../../etc/passwd" is a valid strftime() format specifier? :-) Yes, and since this was for the creation of a log file by an unprivileged process, that would simply fail :) Though the specific case I'm thinking of here was on Windows, so you could probably find an equivalent filename (it didn't prevent absolute names, so you could just stuff whatever you want in) and shoot yourself in the foot big-time. It's the user's own system, let him make a mess of it if he wants :) > But, to answer your question, no, I have nothing against small languages, per-se (and I've done plenty of regex work). But, if my goal is to print a time in some human-readable form: > >>>> print t > > is a lot easier than anything involving strftime(). Sure, it's easier. But there are plenty of types that don't provide a particularly useful repr - regexes being one that only recently changed: 2.7 and 3.3: >>> re.compile(r"(.)\1\1\1") <_sre.SRE_Pattern object at 0x012464F0> >>> _.search("This is a test string with a quadrrrruple letter in it!") <_sre.SRE_Match object at 0x012C3EE0> 3.4: >>> re.compile(r"(.)\1\1\1") re.compile('(.)\\1\\1\\1') >>> _.search("This is a test string with a quadrrrruple letter in it!") <_sre.SRE_Match object; span=(33, 37), match='rrrr'> Would you avoid using regexes in anything less than 3.4 simply because of this lack of repr? It's a convenience, not a deal-breaker. (Or if you disagree with me on that point, you're cutting out a lot of very useful types.) It's not hard to call time.ctime(ts) or strftime(...) for display; the big loser is the interactive interpreter, where a good repr is everything. ChrisA