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


Groups > comp.lang.python > #7612

Re: Rant on web browsers

From "Patty" <patty@cruzio.com>
References <BANLkTimQOK+HxJ4=Qt4s6UC5ELn9BCm2zA@mail.gmail.com>
Subject Re: Rant on web browsers
Date 2011-06-14 07:11 -0700
Newsgroups comp.lang.python
Message-ID <mailman.217.1308060786.11593.python-list@python.org> (permalink)

Show all headers | View raw


----- Original Message ----- 
From: "Chris Angelico" <rosuav@gmail.com>
To: <python-list@python.org>
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 

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


Thread

Re: Rant on web browsers "Patty" <patty@cruzio.com> - 2011-06-14 07:11 -0700

csiph-web