Re: [lxml] Personal problems with resolve_string
P.S. The functions were only a quick test for myself, so the names are not PEP8. However, I've ended up sharing them, so you're right and PEP8 code is a good habit to form. Have you heard Raymond Hettinger talking about PEP8? It's quite amusing and he's a good public speaker: https://www.youtube.com/watch?v=wf-BqAjZb8M
[https://www.bing.com/th?id=OVP.-HpEWP8D7U77A7vY37GFKwEsCs&pid=Api]https://www.youtube.com/watch?v=wf-BqAjZb8M
Raymond Hettinger - Beyond PEP 8 -- Best practices for beautiful intelligible code - PyCon 2015https://www.youtube.com/watch?v=wf-BqAjZb8M
www.youtube.com
"Speaker: Raymond Hettinger Distillation of knowledge gained from a decade of Python consulting, Python training, code reviews, and serving as a core developer. Learn ...
________________________________
From: Jens Quade
class simple_string_resolver(etree.Resolver):
def resolve(self, url, id, context): ... # pass this byte object to the resolve_string method return etree.Resolver.resolve_string(content, id, context, base_url=url)
according to http://lxml.de/1.3/resolvers.html#resolvers self.resolve_string( or etree.Resolver.resolve_string(self, should work. (and do the same, as long as you do not overwrite resolve_string in your simple_string_resolver class.). Also, you may want to follow PEP 8 https://www.python.org/dev/peps/pep-0008/ when naming things (like SimpleStringResolver). best, jens ________________________________ This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system. ________________________________
Am .05.2018, 10:52 Uhr, schrieb Duthie, Roger J.A.
P.S. The functions were only a quick test for myself, so the names are not PEP8.
I think you'll find most people will always expect class names to be capitalised, unless you're really building a functor. PEP8 is a guide and not a prescription, but some ideas are worth going with from the start. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Kronenstr. 27a Düsseldorf D- 40217 Tel: +49-211-600-3657 Mobile: +49-178-782-6226
Hence, the comment about forming good habits... ;¬)
________________________________
From: lxml
P.S. The functions were only a quick test for myself, so the names are not PEP8.
I think you'll find most people will always expect class names to be capitalised, unless you're really building a functor. PEP8 is a guide and not a prescription, but some ideas are worth going with from the start. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Kronenstr. 27a Düsseldorf D- 40217 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 _________________________________________________________________ Mailing list for the lxml Python XML toolkit - http://lxml.de/ lxml@lxml.de https://mailman-mail5.webfaction.com/listinfo/lxml ________________________________ This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system. ________________________________
participants (2)
-
Charlie Clark
-
Duthie, Roger J.A.