3 ms·
I would argue that Python's approach is FAR better than Clojure/Leiningen's "no batteries included" approach. Suppose you want to do a very common task like pa
by xaa 14y ago
I would argue that Python's approach is FAR better than Clojure/Leiningen's "no batteries included" approach.
Suppose you want to do a very common task like parse some XML. In Clojure, the workflow is:
1. Go to Github or Clojars, find the latest version number of clojure.data.xml
2. Add this version number to your project.clj
3. Lein deps and restart the repl
4. Re-acquire whatever REPL data you had
In Python, it's:
1. import xml.{sax,dom,etree}
And, paradoxically, the availability of all these different versions of libraries in Clojure leads to MORE conflicts between libraries than would otherwise be the case, not less. In Python, you may not agree that, say, the "os" or "subprocess" modules are optimal -- but by golly, they're consistent.
- dpritchett 14y agoThanks to pip I often don't even bother with the Python stdlib for crusty things like one-off web scrapes or XML parsing. Here's a recent example where I wanted to read some attributes out of some remote XML and did it with requests and PyQuery rather than urllib and xml: _domains_text = requests.get(API_URL + "/domainlist.xml").content _domains_db = pyquery.PyQuery(_domains_text) DOMAINS = [d.values()[0] for d in _domains_db('domain')]
- RegEx 14y agoI like to set jQuery = pyquery.PyQuery(someHTMLDocumentString) So I can use jQuery like I'm used to. At this point, you can do links = jQuery('a') or whatever.