homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author demian.brecht
Recipients demian.brecht, martin.panter, orsenthil, soilandreyes
Date 2015年03月16日.16:40:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1426524000.73.0.866321966499.issue22852@psf.upfronthosting.co.za>
In-reply-to
Content
I've done an initial pass in Rietveld and left some comments, mostly around docs. Here are some additional questions though:
Given has_* flags can be inferred during instantiation of *Result classes, is there a reason to have them writable, meaning is there a reason to add them to the __init__ methods?
I'd also like to see this logic moved out of _NetlocResultMixinBase. I'm assuming it was put there for backwards compatibility which is understandable, but I don't think it makes sense to add such logic to a mixin who's purpose is additional functionality around the netloc attribute. This one's a little more subjective though, but here's a rough idea of what I'm thinking:
SplitResult = namedtuple('SplitResult', 'scheme netloc path query fragment')
class _SplitResultBase(SplitResult):
 def __new__(cls, scheme, netloc, path, query, fragment):
 inst = super().__new__(cls, scheme, netloc, path, query, fragment)
 inst.has_netloc = bool(netloc)
 return inst
>>> s = urlsplit('http://example.com/foo/bar/')
>>> s.has_netloc
True
This keeps backwards compatibility, but also adds the additional logic to the bases rather than in the mixins. I might also split out the logic into helper functions in order to avoid duplication between _SplitResultBase and _ParseResultBase.
This method also avoids the dependency on ordering of base classes as well as the addition of a variadic signature to (Split|Parse)Result.__init__.
Thoughts?
History
Date User Action Args
2015年03月16日 16:40:00demian.brechtsetrecipients: + demian.brecht, orsenthil, martin.panter, soilandreyes
2015年03月16日 16:40:00demian.brechtsetmessageid: <1426524000.73.0.866321966499.issue22852@psf.upfronthosting.co.za>
2015年03月16日 16:40:00demian.brechtlinkissue22852 messages
2015年03月16日 16:40:00demian.brechtcreate

AltStyle によって変換されたページ (->オリジナル) /