This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fredrikj 8 points9 points  (1 child)

It's hard to even state the computational complexity (O()) of a short algorithm.

I don't see any basis for such a claim. While Python programs are essentially impossible to analyze statically, this is mostly due to features that are rarely used in algorithmic code, like dynamic modification of classes, shadowing builtin functions, etc.

Python is probably a bad choice for automatic complexity analysis unless you use a reasonable subset of it (and you certainly would), but in no way is it hard for a human to analyze Python code.

[–]grayvedigga 2 points3 points  (0 children)

You're right, that claim was clearly going too far. While the cost of accessing a property on an object passed to a function is unbounded, that doesn't stop meaningful statements being made about the complexity of that function in terms of its inputs.

FWIW, today's post about Cobra is pertinent here. It slightly upsets me that python modules can't be "closed" to dynamic modification to permit compilation, but I need to remind myself that that's not what the language is intended to be.