Live data from Hacker News

Why Python is Important for You

blaag.haard.se

191–200 of 231 posts

Re: Why Python is Important for You

#191

Earlier quoted context omitted.

Yeah, I goggled a bit at that one too. Particularly when it's immediately followed by a complaint about things being modified unexpectedly. Some of the complaints are not really issues, eg. you can comment out loops by adding an "if 0:" after commenting out the top line, or else surrounding it with triple quotes """...""". [5] is an outright lie. Major Python apps support 2.4 onwards, true, but virtualenv (a common p…

Python mixes immutability and mutability in ways that require careful thinking about the problem if you want to write unbuggy code. E.g., does a tuple holding lists allow modification of the member lists? Intuitively, it would seem to me that immutability should cascade, but thinking about tuples as holding a bag of pointers suggests that the lists are still mutable. Anyway. I generally take the position that if you…

Virtualenv isn't a hack. How else would you run multiple different versions of Python or a library?

Re: Why Python is Important for You

#192
post #180

Earlier quoted context omitted.

This is a significant problem for me as well, coming from C++ and Haskell. Even just going through and making a few changes here and there, there’s no way for me to know without extensive testing whether my edit was even remotely correct beyond a cursory syntax check. I’ve never had to deal with testing all that heavily in statically typed languages, because I can rely on the type system to do a lot of very helpful s…

I find the focus on dynamic typing a bit fascinating: you don't see people focus so much on it on a discussion about LISP. [EDIT: I meant to say that this most likely reveals something else is at work in the particular case of python]. When a C program compiles, it really does not tell you much about whether it will work or not. Maybe it is a matter of application domains, but I tend to actually spend more time testi…

Lisp’s other useful features just make the particulars of the type system less of an issue. When writing prototypes, I move things around and refactor a lot. Python makes this easy at the cost of certainty about whether it was done right. I don’t write a lot of Lisp, but in my experience refactoring there is quite different: I’m not editing methods and classes, I’m factoring functions and macros. If I were one for supposing, I’d suppose the OO philosophy of Python forces you to create interfaces before you necessarily know that they’re correct, so you end up refactoring them, and there’s poor support for that when no static type system has your back.

Re: Why Python is Important for You

#193
post #172

Earlier quoted context omitted.

This is a significant problem for me as well, coming from C++ and Haskell. Even just going through and making a few changes here and there, there’s no way for me to know without extensive testing whether my edit was even remotely correct beyond a cursory syntax check. I’ve never had to deal with testing all that heavily in statically typed languages, because I can rely on the type system to do a lot of very helpful s…

> I’ve never had to deal with testing all that heavily in statically typed languages, Lack of tests means bugs now, or later when you're refactoring. They're pretty essential in static languages, too, although you can certainly lean on the compiler for many things. Anecdotally, my bugs usually aren't caused by having passed in the wrong kind of an object.

Well yeah, to be fair, neither are mine. It’s just irritating to be running a prototype thinking everything is more or less fine, then SPOOM goes a runtime error because you didn’t properly change a method invocation, which could have been caught by a static check and saved you some time. The more tools I have to help me attain my actual goal of writing software that does stuff without spooming, the better.

Re: Why Python is Important for You

#194

Earlier quoted context omitted.

"I must respectfully disagree. I work with web-based systems" Web-based systems tend toward smallness and/or flatness, with fairly straight execution paths through the system. You're not going to run into the limitations being discussed.

Yeah and big systems architects should really learn from that. A bunch of small services connected by well defined interfaces is the flipping bomb!

When possible, I totally agree. It's great when you can get it. Most of the work I do is just like what you describe. Sometimes it's not, and that's when I really feel the utility of types.

Re: Why Python is Important for You

#196
post #180

Earlier quoted context omitted.

I find the focus on dynamic typing a bit fascinating: you don't see people focus so much on it on a discussion about LISP. [EDIT: I meant to say that this most likely reveals something else is at work in the particular case of python]. When a C program compiles, it really does not tell you much about whether it will work or not. Maybe it is a matter of application domains, but I tend to actually spend more time testi…

Lisp’s other useful features just make the particulars of the type system less of an issue. When writing prototypes, I move things around and refactor a lot. Python makes this easy at the cost of certainty about whether it was done right. I don’t write a lot of Lisp, but in my experience refactoring there is quite different: I’m not editing methods and classes, I’m factoring functions and macros. If I were one for su…

This is already a more interesting discusion. I cannot comment on Lisp, as I have too little experience with it. When you say python forces you to create interfaces, I am not sure I understand. For me, programming is mostly about creating interfaces (as the interface part of API), python or not. When I refactor some C code, static typing does not help me that much, as what's difficult in C is lifetime's object (e.g. ref counting in C extensions), things like that.

What is true is that it is easy to write code that is impossible to refactor, because it is full of globals, or "stringified API" (e.g. using a dict instead of objects when the set of keys is supposed to be fixed). But I am afraid people writing this kind of code would write bad code in any language, or are at least very inexperienced in the language.

Re: Why Python is Important for You

#197
post #142
post #137

Earlier quoted context omitted.

I'm still doing almost everything in Python and whenever Javascript bitches at me about a missed semicolon I do think: "All these fantastic things you can do in a web browser these days and you couldn't figure out that this command in an entirely different line isn't part of the previous line?". I hear you about Python, but JavaScript doesn't require semicolons either, as far as I know. The main reason it's advisable…

JS semicolons are actually encouraged —omitting them, while syntactically valid, can lead to obscure bugs. http://bonsaiden.github.com/JavaScript-Garden/#core.semicolo...

If you are following Crockford (JavaScript, the Good Parts), it is encouraged. However, some, like the current node.js maintainer think otherwise; see http://blog.izs.me/post/2353458699/an-open-letter-to-javascr...

Personally, I still follow Crockford's advice though.

Re: Why Python is Important for You

#198
post #24
post #11

As a commenter on the article wrote: what about Ruby? I say this as a happy Python user. Ruby seems very similar but I'm reminded of a pg essay on language power: looking up the power curve, you see '$Language plus a bit of weird stuff that is probably irrelevant.' So I don't trust myself. As someone who loves Python and doesn't know any Ruby beyond a few bits of syntax and the obvious bits that are common to most la…

Library support. For example, there really is no Ruby equivalent to SciPy, NumPy, Matplotlib or NLTK ( http://news.ycombinator.com/item?id=3179370 ). However, there has been some effort in the Ruby community to begin the process of developing some of these libraries (see SciRuby http://news.ycombinator.com/item?id=3180369 ). but the Python libraries have been in development for years so this will be no easy feat.

As a user of Sage (http://sagemath.org/) I can appreciate that. Nice to have what you need at your fingertips.

Re: Why Python is Important for You

#199
post #180

Earlier quoted context omitted.

This is a significant problem for me as well, coming from C++ and Haskell. Even just going through and making a few changes here and there, there’s no way for me to know without extensive testing whether my edit was even remotely correct beyond a cursory syntax check. I’ve never had to deal with testing all that heavily in statically typed languages, because I can rely on the type system to do a lot of very helpful s…

I find the focus on dynamic typing a bit fascinating: you don't see people focus so much on it on a discussion about LISP. [EDIT: I meant to say that this most likely reveals something else is at work in the particular case of python]. When a C program compiles, it really does not tell you much about whether it will work or not. Maybe it is a matter of application domains, but I tend to actually spend more time testi…

"I find the focus on dynamic typing a bit fascinating: you don't see people focus so much on it on a discussion about LISP. "

Interesting point.Thinking back on the Clojure discussions here over the last two years i don't recall many issues with readability/maintainability due to the lack of a static types system.

Re: Why Python is Important for You

#200
post #180

Earlier quoted context omitted.

I find the focus on dynamic typing a bit fascinating: you don't see people focus so much on it on a discussion about LISP. [EDIT: I meant to say that this most likely reveals something else is at work in the particular case of python]. When a C program compiles, it really does not tell you much about whether it will work or not. Maybe it is a matter of application domains, but I tend to actually spend more time testi…

"I find the focus on dynamic typing a bit fascinating: you don't see people focus so much on it on a discussion about LISP. " Interesting point.Thinking back on the Clojure discussions here over the last two years i don't recall many issues with readability/maintainability due to the lack of a static types system.

Are there any really big multi programmer clojure code bases yet though ?
Post reply on HN