As others have said, it depends on so many factors. I'm still learning perl (my primary language) ten years after I started. I was writing working code in Ruby after a weekend, and I believe I could be fluent in it within a week or two of working primarily in that language. Python I've never set out to learn, but several years of working with Python projects and developers has given me the ability to patch in what I need in existing projects without a struggle (but I couldn't start from scratch).
It also depends on how you learn it, and who you learn it from. The pickax book is a fantastic book for learning ruby. Same goes for Learning Perl for perl. I've never seen a similar book for Python, but one might exist? For JavaScript you cannot beat Douglas Crockford's videos at the Yahoo! Developer Network. Absolutely fantastic...taught me everything I needed to know to be productive in the language in one weekend. JavaScript also happens to be a great learning language, as it has both functional and imperative constructs and pretty simple syntax and minimal keywords.
Find all of them (along with a few other good ones--Joe Hewitt's Firebug demo, in particular, is what you'll want after the Crockford vids) here:
I'm using Python: Essential Reference by David M. Beazley(Third Edition) to learn Python. It's got a no-nonsense tutorial that plows through all the basics first, then has a large reference for the Standard Library. The reference is very similar (almost word for word in some cases) to the online library reference.
I haven't found anything yet, though, on advanced techniques or how to write "pythonic" code. I decided to start reading "On Lisp," instead.
The longer you've programmed, the less time it takes.
But learning syntax and libraries is much different than (for lack of a better word) learning the "zen" of it. You could learn python and just write C-style code in it in a few hours, but it might take much much longer to change the way you look at and solve problems to match the strengths of a language.
Like a lot of others have said here, it depends on where you define your threshold for having "learned" a language. To get reasonably productive in a language to the point where you can (eventually) build most things shouldn't take more than week if you have a few under your belt.
Then there is the long process learning the right idioms, keeping up with the latest changes in newer languages, familiarizing yourself with the universe of libraries, etc, etc - I think all of these things are required to really claim fluency in a language. So I would answer "a long, long ass time."
Agreed, a week for basic literacy and years for mastery. Based on my own experience I'd say it takes two years of using a language every day and following news groups to be able to write it idiomatically. Every year after that helps you get stuff done (knowledge of tool chains, packages, and the dustiest corners of the language) but the returns are diminishing.
Code from those early days of basic literacy are the thoughest to look back on. "Hey, why does this perl code look like it is trying to be C++?"
For Algol-like languages it takes me about 5,000 lines written and 20,000 lines read before I feel comfortable with it. A good way to do this is to re-implement some pet program in the new language. That way you don't confuse the work of a new problem with the work of the new language.
[edit] I second far33d. You can write FORTRAN in any language. :) Each language has its own conceptual style, idioms, and so on. Learning how to think in a language is real fluency.
It depends on how similar it is to what you're already familiar with. Learning a new imperative language is different from learning your first functional language.
I learned Python so quickly, I used to stare at the 2 lines I'd just written that did the same work as 20 in C++. My brain had to play catch-up since it was used to autopiloting while filling in the tedium.
So true (about Python vs. C). Same with java: I spend a lot of the time filling in straw. Python makes me think because almost every line is actually meaningful.
As for how long with a new language: speaking without quantitative data, I'd say differences in motivation are much larger than differences in languages, for languages with a reasonable set of libraries (i.e. brainfuck and the like excluded).
Mastery? Heck, I've been programming in C for 15 years and Perl for 10, and I don't think I'm a master in either.
And at this point I can pick up a new language (Javascript, say, which is my current sort-of project) and it's just a matter of learning syntax because I've used that concept in another language before.
Learning Perl took me about two weeks, Ruby about a week :-), Java it took me about a month. It was soo painful to learn Java after Ruby and Perl. Cuz I was doing some mobile phone applications with J2ME. Thankfully I'm back on track with Ruby for my start up app.
Maybe I shouldn't have written "average" then, perhaps we can get an impression. And I am not sure if it depends on the programming languages you already know - maybe it mostly depends on knowing at least one language? I know it is all very fuzzy, for example what does it mean to know Java - surely not to know all available libraries by heart. But maybe people here can give an intuitive answer to the question?
My own estimate would be about a week (I can program after a few hours of course, but not with as much confidence as after a week).
I learned ruby functionally in about a month, and fluently (eg thinking in ruby idiom) took about three months of half-time work in it. I wouldn't say I'm a guru yet, though, just comfortable.
Haskell is still kicking my ass after six weeks of spare-time though, so I think it has more to do with the language than anything.
It also depends on how you learn it, and who you learn it from. The pickax book is a fantastic book for learning ruby. Same goes for Learning Perl for perl. I've never seen a similar book for Python, but one might exist? For JavaScript you cannot beat Douglas Crockford's videos at the Yahoo! Developer Network. Absolutely fantastic...taught me everything I needed to know to be productive in the language in one weekend. JavaScript also happens to be a great learning language, as it has both functional and imperative constructs and pretty simple syntax and minimal keywords.
Find all of them (along with a few other good ones--Joe Hewitt's Firebug demo, in particular, is what you'll want after the Crockford vids) here:
http://developer.yahoo.com/yui/theater/