Take this code:
>>> import urlparse
>>> parts = urlparse.urlparse('http://docs.python.org/library/')
>>> parts = parts._replace(path='/3.0'+parts.path)
parts._replace works
but as it is an underscored method, it's supposed to be internal, and not used. Is there an alternative? I don't want to do:
>>> parts = parts[:2] + ('/3.0'+parts.path,) + parts[3:]
Because that makes it an ordinary tuple, and not a namedtuple, and doing:
>>> parts = namedtuple(scheme=parts.scheme, netloc=parts.netloc, etc etc)
is kinda stupid. :)
Ideas?