Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'string.': 0.04; 'instance': 0.05; 'javascript,': 0.05; 'though.': 0.07; 'python': 0.08; 'delimiter': 0.09; "everyone's": 0.09; 'incompatible': 0.09; 'oh,': 0.09; 'plus,': 0.09; 'output': 0.11; 'debugging': 0.14; '"int': 0.16; 'angelico': 0.16; "else's": 0.16; 'failing,': 0.16; 'jumping': 0.16; 'received:mail.comcast.net': 0.16; 'slashes': 0.16; "there'll": 0.16; 'translate,': 0.16; 'class,': 0.16; 'things.': 0.16; 'input': 0.17; 'language': 0.18; 'starts': 0.20; 'to:2**1': 0.20; 'figure': 0.21; '(like': 0.21; 'stuff': 0.22; 'parse': 0.23; 'worst': 0.23; '-----': 0.23; 'objects': 0.23; '(or': 0.24; 'code': 0.24; "doesn't": 0.25; 'function': 0.25; 'url:mailman': 0.26; 'string': 0.26; 'object': 0.26; 'up.': 0.26; 'thanks.': 0.27; 'helpful': 0.28; 'random': 0.28; '(as': 0.29; 'subject:web': 0.29; 'exists': 0.29; 'fine.': 0.29; 'instead': 0.29; 'subject:': 0.30; 'url:listinfo': 0.30; 'dom': 0.30; 'x-mailer:microsoft outlook express 6.00.2900.5931': 0.30; 'entry': 0.31; 'looks': 0.31; 'it.': 0.31; 'anyone': 0.32; "can't": 0.32; 'components': 0.32; 'expression': 0.32; 'to:addr :python-list': 0.33; 'topic': 0.33; "i've": 0.33; 'regular': 0.34; 'chris': 0.34; 'sent:': 0.34; 'file': 0.34; 'force': 0.34; 'there': 0.35; 'from:': 0.36; 'difference': 0.37; 'supporting': 0.37; 'change': 0.37; 'bother': 0.37; 'coding': 0.37; 'third- party': 0.37; 'pretty': 0.37; 'put': 0.37; 'two': 0.37; 'url:python': 0.38; 'received:76': 0.38; 'anything': 0.38; 'url:org': 0.38; 'but': 0.38; 'features.': 0.38; 'monday,': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'spent': 0.39; 'difficult': 0.39; 'add': 0.39; 'to:addr:python.org': 0.39; 'everyone': 0.40; 'really': 0.40; 'format': 0.40; 'delete': 0.40; 'results': 0.60; 'more': 0.60; 'hope': 0.60; 'browser': 0.62; 'back': 0.63; 'free': 0.63; 'simple,': 0.65; 'day': 0.67; 'browser,': 0.67; 'illegal': 0.72; 'june': 0.77; 'browser.': 0.77; '(oh': 0.84; '11:31': 0.84; 'fault,': 0.84; 'fields).': 0.84; 'standard,': 0.84; 'something.': 0.91; 'browsers': 0.93; 'greatest': 0.95 From: "Patty" To: "Chris Angelico" , References: Subject: Re: Rant on web browsers Date: Tue, 14 Jun 2011 07:11:54 -0700 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6090 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: 60 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308060786 news.xs4all.nl 49174 [::ffff:82.94.164.166]:52915 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7612 ----- Original Message ----- From: "Chris Angelico" To: Sent: Monday, June 13, 2011 11:31 PM Subject: Rant on web browsers > Random rant and not very on-topic. Feel free to hit Delete and move on. > > I've just spent a day coding in Javascript, and wishing browsers > supported Python instead (or as well). All I needed to do was take two > dates (as strings), figure out the difference in days, add that many > days to both dates, and put the results back into DOM Input objects > (form entry fields). Pretty simple, right? Javascript has a Date > class, it should be fine. But no. First, the date object can't be > outputted as a formatted string. The only way to output a date is "Feb > 21 2011". So I have to get the three components (oh and the month is > 0-11, not 1-12) and emit those. And Javascript doesn't have a simple > format function that would force the numbers to come out with leading > zeroes, so I don't bother with that. > > What if I want to accept any delimiter in the date - slash, hyphen, or > dot? Can I just do a simple translate, turn all slashes and dots into > hyphens? Nope. Have to go regular expression if you want to change > more than the first instance of something. There's no nice string > parse function (like sscanf with "%d-%d-%d"), so I hope every browser > out there has a fast regex engine. When all you have is a half-ton > sledgehammer, everything looks like a really REALLY flat nail... > > Plus, Javascript debugging is annoyingly difficult if you don't have > tools handy. I need third-party tools to do anything other than code > blind? Thanks. > > Oh, and "int i" is illegal in Javascript. Whoops. That one is my fault, > though. > > Javascript's greatest strength is that it exists in everyone's > browser. That is simultaneously it's worst failing, because it becomes > nigh impossible to improve it. If Chrome's V8 starts supporting new > features and everyone else's JS engines don't, we can't use those > features. Even if they're added to the standard, there'll still be old > browsers that don't support things. The only way to add to the > language is to dump stuff into a .js file and include it everywhere. > > But if anyone feels like writing an incompatible browser, please can > you add Python scripting? > > Chris Angelico > -- > http://mail.python.org/mailman/listinfo/python-list > > Hi Chris - I am just learning JavaScript and this was helpful to me, not a rant. I am reading JavaScript: The Good Parts so he is jumping around in topic and I can just use this when learning about dates and ints coming up. Patty