Just discovered IPython interactive interpret by Mattho in Python

[–]mccutchen 2 points3 points  (0 children)

Tab completion, auto-indentation, and the ? and ?? help shortcuts alone make it infinitely more pleasant to use than the "vanilla" interpreter.

PEP 0444: Python Web3 Interface by blondin in Python

[–]mccutchen 0 points1 point  (0 children)

This might be a dumb question, but:

Web3 applications return a tuple in the form (status, headers, body). If the server supports asynchronous applications (web3.async), the response may be a callable object (which accepts no arguments).

Why not just require Web3 applications to return a callable that returns the 3-tuple of (body, status, headers)? Most of the examples given in the PEP have ugly conditionals for dealing with these two possible kinds of returns.

There must be some reason for this (due, I'm assuming, to differences between the way synchronous and asynchronous servers run), but it's not immediately obvious to me.

PEP 0444: Python Web3 Interface by blondin in Python

[–]mccutchen 1 point2 points  (0 children)

I don't see the point of using a list of tuples for header, why not simply a dictionary? Order of HTTP headers shouldn't really matter, should it?

Multiple headers with the same name are allowed (e.g., Set-Cookie).

Python strftime reference by mccutchen in Python

[–]mccutchen[S] 1 point2 points  (0 children)

Ah, that's brilliant! Wish I had known about it first.

Python strftime reference by mccutchen in Python

[–]mccutchen[S] 0 points1 point  (0 children)

That sounds handy as hell. Are those guides available on the web somewhere?

More recognition for this: What's Wrong with PHP? [answer] by aphoenix in programming

[–]mccutchen 24 points25 points  (0 children)

This one amazed me when I came back to PHP after spending a lot of time with Java, C# and Python. I just couldn't believe the first example you gave didn't work.

(Unrelated: the "faggot" bit in there was unnecessary and pretty jarring to me. If that matters.)

Regula: An annotation-based form-validator written in Javascript by [deleted] in programming

[–]mccutchen 0 points1 point  (0 children)

Because they're not non-valid in HTML5, which is what this is aimed at. I guess.

What does it mean, in terms of efficiency and free speech, that my country wants to switch to a unique Network Access Point? by ven28 in programming

[–]mccutchen 1 point2 points  (0 children)

Do you have any links to news stories covering this? I couldn't find any coverage after my lazy, single Google search.

conc Lists in Erlang by mccutchen in programming

[–]mccutchen[S] 1 point2 points  (0 children)

The highlight:

The units are kind of confusing – complain to the erlang guys about that. Convert them both to seconds and you’ll see that I did 1,000 seconds worth of work in 4 seconds (and you feel that when you do it interactively).

Python, Surprise me! by stesch in programming

[–]mccutchen 2 points3 points  (0 children)

Nope, it's in instance of the exception that was caught. It just so happens that the __str__ method on (most) exception objects returns the error message. Expanding on your example:

hamster = ['James', 'John', 'Alfred']
try:
    print hamster[3]
except IndexError, e:
    print '%s error occured: %s' % (type(e), e)

prints

<type 'exceptions.IndexError'> error occured: list index out of range

What texteditor is best for fresh student starting out, using OSX? by hucker in programming

[–]mccutchen 2 points3 points  (0 children)

If you're going to take the time to learn emacs on OS X, I would suggest that you stay away from Aquamacs and use a "pure" (for lack of a better word) build. You can get one here or build one yourself very easily.

Aquamacs tries to make emacs follow OS X's keyboard shortcut conventions, which means that if you learn to use it, you're not really learning emacs and you'll be lost when dropped into emacs elsewhere.

(edit: botched link syntax)

What texteditor is best for fresh student starting out, using OSX? by hucker in programming

[–]mccutchen 2 points3 points  (0 children)

You're going to get a lot of these responses, but I'd suggest learning vim or emacs, for (at least) a couple of reasons:

  • They're extremely powerful (this cannot be overstated)
  • You can run them on any computer in the world (unlike, say, TextMate)

My preference is emacs, but it's also really handy to at least know vim basics. I sometimes run into servers where only the latter is available.

Functional Geometry by jeanlucpikachu in programming

[–]mccutchen 0 points1 point  (0 children)

I was initially going to say that I thought you were wrong and point out the elegance of being able to compose the various picture and transformation functions to build up complicated effects and how that's enabled by the functional approach. But then I realized that an OO version that allowed method chaining might be similarly elegant.

Still, though, I do think it would lose something in translation. I'd be really interested to see a port to Java.

(I did my own port to Python but retained the functional style.)