Live data from Hacker News

Why Python is Important for You

blaag.haard.se

141–150 of 231 posts

Re: Why Python is Important for You

#141

I have a list I wrote up once about Python's problems. Some of these are more exotic than others. Most of them are kludgearoundable. A couple are fixed in Python 3. Some are simply design choices that are exactly different from my mental model of the world, and due to the TOOWTDI Python world, it is frustrating to work with them. Some Things Wrong With Python * Immutable strings[0] * Everything a reference[1] * Envir…

Perfect. But please tell me ONE language which does/fixes all the above + pure merits of Python.

It is a general rule that no language makes everyone happy all the time. Seeking for the ideal, however, is fine in my books.

I am not into purity in languages, as a personal rule of thumb. I favor Common Lisp for applications, Perl for scripts, and C (or C++) for driver layer code. Those are considered pits of impurity quite often.

Re: Why Python is Important for You

#142
post #137
post #133

Many years ago I've decided it was time to pick up a modern programming language. In the past I had written lots of (Turbo) Pascal code, some x86 (and more exotic) Assembler and a bit of C, but then for several years I only did shell/awk scripts and ported C software to IRIX and SINIX/RU. So I sat down and decided to find a nice general-purpose language that I would focus on learning. I wasn't quite sure what for yet…

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...

Re: Why Python is Important for You

#143
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…

I'm an extremely happy ruby user but have nothing against python, it's just that the languages operate at such a similar level of abstraction that it seems like a bit of a waste to spend time learning python when I could be learning C or Haskell. FWIW though, I get serious library envy, especially with regard to NLTK. Ruby has web development cornered but is decades behind python when it comes to anything around mach…

> Ruby has web development cornered but is decades behind python when it comes to anything around machine learning and scientific computing.

The irony of this is that many folks in the Python scientific computing space pine for better syntax extension facilities so that they could do more "natural" DSLs for data analysis and embedding math inside Python code.

The object lesson here is that communities and passionate users matter. Python took root in some scientific computing environments and certain dedicated individuals built up a software library and invested in growing a community that is now a force to be reckoned with. If the same people had all chosen Ruby and built a community around that, there is no obvious reason why Ruby shouldn't be the one with the great scientific libraries.

Re: Why Python is Important for You

#144

I do love Python, but I often wish there was more rigor for some things. I currently work on a large project (>500K LOC) and have started to see it fall apart with a bigger team. Lack of enforced typing in function arguments, inability to create strict interfaces, inconsistency in standard library conventions, and package management would probably be my biggest gripes.

500K LOC in Python is what, 2.5M->5M in a statically typed language? At that size I would expect any project to require explicit convention and communication management, simply because no one person can hold the whole thing in their mind at a resolution that reveals the code's meaningful features.

"500K LOC in Python is what, 2.5M->5M in a statically typed language?"

Depends if the statically typed language is Java or Haskell.

Re: Why Python is Important for You

#145
post #131

Earlier quoted context omitted.

Python 2 to Python 3 is a big jump once in a lifetime. what about ruby 1.9 to ruby 2.0?

ruby 2.0 will likely be just as easy as 1.8 to 1.9, if not easier.

so, it's not as easy as python 2.x to 2.(x+1) and python 3.x to 3.(x+1). will every version update of Ruby will suffer as mush as Ruby 1.8 to 1.9?

Re: Why Python is Important for You

#146
post #55

Earlier quoted context omitted.

The way I would do it is to push the processing out to functions, too. Something like: verdict = get_verdict(the_thing) if verdict not in blessedsolutions: return I'd advise against running returns onto the same line - I find it makes it harder to read, particularly when you have a lot of checks like this.

"The way I would do it is to push the processing out to functions, too." This is indeed a good idea to isolate code away, but wouldn't alleviate a deeply nested control structure. It would make it somewhat more easier to look at, though. "I'd advise against running returns onto the same line " I usually follow PEP8 and place returns and continues on the next line, but the code examples I posted earlier had to be a bi…

Sometimes your problem space is really just that complex, in which case there's not much you can do, short of writing some sort of business rules engine.

Re: Why Python is Important for You

#147

I have a list I wrote up once about Python's problems. Some of these are more exotic than others. Most of them are kludgearoundable. A couple are fixed in Python 3. Some are simply design choices that are exactly different from my mental model of the world, and due to the TOOWTDI Python world, it is frustrating to work with them. Some Things Wrong With Python * Immutable strings[0] * Everything a reference[1] * Envir…

You forgot mutable default arguments! def fn(ls=[]): ls += [1] return len(ls) (My syntax might be a little off, but you get the idea.) This will return an ever-increasing number if called repeatedly with no arguments. Also, the reliance on tuples, particularly tuples of one item always gets me because (1) and (1,) are different. Also, the scoping for list comprehensions doesn't make sense: x = 11 [x for x in [1,2,3]]…

Just for the record list comp scoping is fixed in python 3:

    $ python3
    Python 3.2.1 (default, Aug  1 2011, 14:47:14) 
    [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> x = 11
    >>> [x for x in [1,2,3]]
    [1, 2, 3]
    >>> x
    11

Re: Why Python is Important for You

#148
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…

That depends on your taste buds. Mine prefer consistency. Ruby is a alippery slope when it comes to consistency and it requires the whole community to change certain attitudes.

Ruby seems more consistent to me, as it follows the "everything is an object" design principle quite rigorously. Python does not have any consistent design principle like that at its core, as far as I can tell.

Re: Why Python is Important for You

#149
post #138

I have a list I wrote up once about Python's problems. Some of these are more exotic than others. Most of them are kludgearoundable. A couple are fixed in Python 3. Some are simply design choices that are exactly different from my mental model of the world, and due to the TOOWTDI Python world, it is frustrating to work with them. Some Things Wrong With Python * Immutable strings[0] * Everything a reference[1] * Envir…

You think immutable strings is a bad thing?

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 piece of Python infrastructure) can support arbitrary libraries and versions of python: http://stackoverflow.com/questions/1534210/use-different-pyt.... And I've never heard of duck typing 'auto casting' anything - code example?

Most of the rest is either a style thing, eg. "lambdas are broken!" (Just define a function first then use it, or use a decorator. You can't write lisp in python), or else broken in other languages too. [4.5] is true for any language, including compiled statically typed languages, not just Python.

Re: Why Python is Important for You

#150

I have a list I wrote up once about Python's problems. Some of these are more exotic than others. Most of them are kludgearoundable. A couple are fixed in Python 3. Some are simply design choices that are exactly different from my mental model of the world, and due to the TOOWTDI Python world, it is frustrating to work with them. Some Things Wrong With Python * Immutable strings[0] * Everything a reference[1] * Envir…

[deleted]
Post reply on HN