LWN.net Logo

What is to replace Perl then?

What is to replace Perl then?

Posted Dec 4, 2008 0:15 UTC (Thu) by sbergman27 (subscriber, #10767)
In reply to: What is to replace Perl then? by jwb
Parent article: On the future of Perl 5

"""
That wasn't exactly what I was referring to
"""

You mean when you said: "You can do anything you want in python, except the incredibly simple things like parsing URLs."? Yeah, I can see where you might really have meant you have a trivial quibble with the syntax.

Python URL parsing 101, in case anyone is interested:

---
from urlparse import urlparse

> o = urlparse('http://user:password@google.com:8080/')
> o.scheme
'http'

> o.netloc
'user:password@google.com:8080'

> o.path
'/'

> o.username
'user'

> o.password
'password'

> o.hostname
'google.com'

> o.port
8080
---


(Log in to post comments)

What is to replace Perl then?

Posted Dec 4, 2008 0:17 UTC (Thu) by jwb (guest, #15467) [Link]

That's great, now what are you going to do with that tuple? You can't feed it to urllib2. urllib2 wants the URL as a string, but it can't parse all the ones that urlparse can parse. See the problem?

What is to replace Perl then?

Posted Dec 4, 2008 2:40 UTC (Thu) by drag (subscriber, #31333) [Link]

Ya. I would consider that a bug.

What is to replace Perl then?

Posted Dec 4, 2008 3:42 UTC (Thu) by sbergman27 (subscriber, #10767) [Link]

If so, it doesn't seem to be one that many Python users care about. I spend a lot of time in Python web development communities (Django, TurboGears) and its not something I hear complaints about.

urllib does support this directly:

---
from urllib import urlopen
> x = urlopen('http://myuser:mypasswd@google.com/')
> len(x.read())
5856
---

There have, however, been a couple of request nibbles on the issue tracker over the last 4 years or so to add the functionality to urllib2 as well, and no actual opposition to it. Interestingly, there was activity today from a dev saying he was implementing it, noting that it would be trivial to do.

Personally, I think its probably a good idea, but since its just a few lines to handle this case, it doesn't really bother me.

Like I said, this seems something of a cherry-picked example to "prove" that Python's url handling is "not mature". I'm sure that Python and Ruby folks could pick more than a few cherries regarding Perl's problems if they wanted to.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds