Live data from Hacker News

Python for Humans

speakerdeck.com

51–60 of 74 posts

Re: Python for Humans

#51
post #17
post #9

Earlier quoted context omitted.

While not a table of "stdlib package => 3rd party package", there is this: http://docs.python-guide.org/en/latest [ Also by Kenneth Reitz ]

That link doesn't appear to work for me, so I think the same content is available at http://docs.python-guide.org/

Sorry. Looks like the trailing slash was omitted when I copy-pasted that from the location bar. ^^;;

Re: Python for Humans

#52

Earlier quoted context omitted.

I'm not sure why you feel this niche requirement requires three question marks. The point of modules like this is to make it easier to do the tasks that 95% of developers are likely to need to do regularly, at the cost of not covering all rare use cases.

It's a reasonable tradeoff for a specific library. But if he's trying to claim that the entire eco-system should put the API above all, then it's worth asking how the 5% use case integrates with this worldview. If I suddenly find I need multiple IPs, do I now need to switch my http client library?

The slides don't mention this, but he did touch on having layered designs so the 5% remains possible. However, the primarily exposed api shouldn't get sacrificed for said features. By conceding on a feature that makes the API less usable, you sacrifice more than not having it in the first place (confusion, complexity). Even the GH Issue linked shows a possible solution to the issue using urllib2, which is just a layer down.

Re: Python for Humans

#53

Earlier quoted context omitted.

I'm not sure why you feel this niche requirement requires three question marks. The point of modules like this is to make it easier to do the tasks that 95% of developers are likely to need to do regularly, at the cost of not covering all rare use cases.

It's a reasonable tradeoff for a specific library. But if he's trying to claim that the entire eco-system should put the API above all, then it's worth asking how the 5% use case integrates with this worldview. If I suddenly find I need multiple IPs, do I now need to switch my http client library?

No, you need to do what anyone who has fringe requirements has to do: patch the library yourself. Modify urllib3's (requests uses this as a go between for httplib/http.client) to accept/pass on the source_address that the HTTPConnection from httplib allows and then modify requests to accept/pass this on. This will take, at first glance, maybe half a day with some tests (likely much faster, but I'll allow that there might be something more involved than modifying urllib3's HttpConnectionPool and the accompanying changes for requests's Request model.

Re: Python for Humans

#54
post #51
post #17

Earlier quoted context omitted.

That link doesn't appear to work for me, so I think the same content is available at http://docs.python-guide.org/

Sorry. Looks like the trailing slash was omitted when I copy-pasted that from the location bar. ^^;;

That does seem to be the problem. But that seems wrong?

Re: Python for Humans

#55
post #50

As much as I know everyone dislikes PHP, there's lots of people still working with it. I love Requests in Python, so I built Requests for PHP: http://requests.ryanmccue.info/ I have to agree with Kenneth's points, in that pragmatism should outweigh the theoretical points. For example, in PHP, using a class as a grouping for static methods is a bad idea. I agree to a point, but there's something to be said for the abi…

If autoloading namespaces or namespaced functions was possible then static classes wouldn't be needed and things like this would be commonplace:

    \Requests\get('http://google.com');

Re: Python for Humans

#56
post #8
post #4

Wow, this is cool. Kenneth has started to identify and call out other libraries that are "barriers to entry" in Python. If this is a call to arms to scale the Requests experience, it could grow into something really powerful - a movement to systematically reinvent and rejuvenate the Python standard library.

Yep. I was looking for exactly this list. Incidentally Python could use an more equivalent to djangopackages.com to help in identifying popular alternatives to standard lib packages.

I'm of the leads on that project. We're working on upgrading the code base to support all of Python, and hope to have that ready by PyCon US.

Re: Python for Humans

#57
Reminds me of a chat session I had with a dev at another office a few days ago:

  him: "have you ever used urllib2"
  me: "not if I can avoid it"
  him: "I've just spent 3 days trying to do X"
  me: "have you heard of Requests"
  him: "nope"
  ...send URL...
  him: "god damn it!  Why didn't I talk to you three days ago"
20 minutes later he's replaced three days work with a dozen lines of easy to read Requests code.

Re: Python for Humans

#58

Slightly off topic: in an effort to become a better programmer, and to improve the Python ecosystem, I've tried to write a "for Humans" style logging library. Would anyone mind giving me feedback? http://peterdowns.com/lggr/

I like the idea of delegating logging to its own process in theory (in practice, it would depend on your configuration, I guess, it may mean a lot of context switching), but your built-in coroutines seem to rely on yield instead. Have you experimented with all three styles?

A big feature missing, IMHO, is file-based configuration. You definitely want this for larger projects.

Re: Python for Humans

#59
post #50

As much as I know everyone dislikes PHP, there's lots of people still working with it. I love Requests in Python, so I built Requests for PHP: http://requests.ryanmccue.info/ I have to agree with Kenneth's points, in that pragmatism should outweigh the theoretical points. For example, in PHP, using a class as a grouping for static methods is a bad idea. I agree to a point, but there's something to be said for the abi…

I'll check this out. I use python at home but have to use PHP at work. Thanks :)

Re: Python for Humans

#60

Slightly off topic: in an effort to become a better programmer, and to improve the Python ecosystem, I've tried to write a "for Humans" style logging library. Would anyone mind giving me feedback? http://peterdowns.com/lggr/

Interesting. This is weird as fuck, though:

    d.critical("Someone {} us {} the {}!", "set", "up", "bomb")
See that seems ambiguous - does it actually use the string formating mini-lanaguage?
Post reply on HN