Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7589

Rant on web browsers

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
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; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 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; 'figure': 0.21; '(like': 0.21; 'stuff': 0.22; 'parse': 0.23; 'received:209.85.210.174': 0.23; 'received:mail- iy0-f174.google.com': 0.23; 'worst': 0.23; 'objects': 0.23; '(or': 0.24; 'code': 0.24; "doesn't": 0.25; 'function': 0.25; 'string': 0.26; 'object': 0.26; 'thanks.': 0.27; 'message- id:@mail.gmail.com': 0.28; 'random': 0.28; '(as': 0.29; 'subject:web': 0.29; 'exists': 0.29; 'fine.': 0.29; 'instead': 0.29; 'dom': 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; "i've": 0.33; 'regular': 0.34; 'chris': 0.34; 'file': 0.34; 'force': 0.34; 'there': 0.35; 'difference': 0.37; 'supporting': 0.37; 'received:google.com': 0.37; 'change': 0.37; 'received:209.85': 0.37; 'bother': 0.37; 'coding': 0.37; 'third-party': 0.37; 'pretty': 0.37; 'put': 0.37; 'two': 0.37; 'anything': 0.38; 'but': 0.38; 'features.': 0.38; 'should': 0.39; 'received:209': 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; 'browser.': 0.77; '(oh': 0.84; 'fault,': 0.84; 'fields).': 0.84; 'standard,': 0.84; 'something.': 0.91; 'browsers': 0.93; 'greatest': 0.95
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=xW0tYFSeEwAHwVl1TWHj7QLAsUSqyySOXfoU0zH7vbY=; b=fCmYXfn+14AynqtIeNcd2QIfusL6kSrBExXYnEBUCgnbBotnMPHC8+Pke1NQEnu405 QdiX2abBecVwYCho4O+UX8cIveCH+LD/+9IMZ3abYSbHaztbx8Z5Hspa+sNk3OXESqFu Y79a2SZNOrwGT2GrHHUYgDP0t0W7sIerrRxKM=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=THzTXK6UE6eOuFFKLH2MhYB+cGRSxOx9iP5SFZApKPtNCCXMfYzd73A43f8TyAlz2L h5hbKEAcPEfNIA4tGMaZ4UKqlm/SUgDI3cCIbUsZkNznLkSbniM1B0w/e8ZosdpSScpW eNvUO3fiPBzEhMTMnaQy9aQWQyiXndnyo4fUk=
MIME-Version 1.0
Date Tue, 14 Jun 2011 16:31:05 +1000
Subject Rant on web browsers
From Chris Angelico <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.210.1308033067.11593.python-list@python.org> (permalink)
Lines 40
NNTP-Posting-Host 82.94.164.166
X-Trace 1308033068 news.xs4all.nl 49177 [::ffff:82.94.164.166]:38420
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7589

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Rant on web browsers Chris Angelico <rosuav@gmail.com> - 2011-06-14 16:31 +1000
  Re: Rant on web browsers "Martin P. Hellwig" <martin.hellwig@gmail.com> - 2011-06-14 09:39 +0100
    Re: Rant on web browsers Chris Angelico <rosuav@gmail.com> - 2011-06-14 18:46 +1000
    Re: Rant on web browsers Daniel Kluev <dan.kluev@gmail.com> - 2011-06-21 18:12 +1100
  Re: Rant on web browsers Asen Bozhilov <asen.bozhilov@gmail.com> - 2011-06-14 15:33 -0700
  Re: Rant on web browsers Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-06-22 18:37 +0200
  Re: Rant on web browsers lkcl <luke.leighton@gmail.com> - 2011-07-24 12:58 -0700
  Re: Rant on web browsers lkcl <luke.leighton@gmail.com> - 2011-07-24 13:00 -0700

csiph-web