mastahyeti added the comment:
Hrmm. Okay. I concede.
On Thu, Aug 30, 2012 at 2:16 PM, R. David Murray wrote:
>
> R. David Murray added the comment:
>
> Not in this case. We are treating the URL as an immutable object, so the
> Pythonic thing to do is create new object of the
mastahyeti added the comment:
I can live with that, it just seems that ordinary item assignment is
more pythonic
On Thu, Aug 30, 2012 at 2:03 PM, R. David Murray wrote:
>
> R. David Murray added the comment:
>
> Actually, Senthil is right. What you want is the _repla
mastahyeti added the comment:
Senthil,
Can you give an example of how namedtuple would be more convenient? It
is definitely more convenient than an ordinary tuple, but its
inconvenient having its items not be assignable. As I showed in my
example above, it is usable as-is, but it is clunky. As
mastahyeti added the comment:
This is my first patch for python. Is there a feature freeze? Does it
need to go in Python3? Thanks.
On Thu, Aug 30, 2012 at 1:22 PM, Ezio Melotti wrote:
>
> Ezio Melotti added the comment:
>
> This is a new feature, so it can't go in 2.7.
>
mastahyeti added the comment:
TYPO!!!
After my patch, urlparse can be used as such:
import urlparse
url = urlparse.urlparse('http://www.example.com/foo/bar?hehe=haha')
url.netloc = 'www.python.com'
urlparse.urlunparse(url)
The difference being that the re
New submission from mastahyeti:
This patch removes the inheritance from namedtuple and attempts to add the
necessary methods to make it backwards compatible.
When parsing a url with urlparse.urlparse, the return type is non-mutable
(named tuple). This is really inconvenient, because one of