News for hackers. Stuff that matters.
Re:Python is now the most popular introductory language at t... by baq on Monday July 07, 2014 @05:17PM (#8001486)
rust? please. maybe 3 years from now, once it matures. python is good for teaching programming because it's easy to read - a feature that not a single language you mention can brag about.
Re:Python is now the most popular introductory language at t... by Igglyboo on Monday July 07, 2014 @05:23PM (#8001514)
It's easy to read and it just makes more sense when someone only knows English.

I could show this to my 80 year old grandmother and have her understand what it does with minimal help on my part.

    word_list = ["hat", "dog", "cat"]
    for word in word_list:
        print(word)
The same example in Java isn't extremely hard to understand, but it definitely is a decent jump in complexity from the almost plain English syntax of Python.

    String[] word_list = {"hat", "dog", "cat"}
    for(int i=0; i < word_list.length; i++){
        System.out.println(word_list[i]);
    }
EDIT: Forgot about Java's foreach operator, but even so with java you then have to explain what String[] means and the keyword "in" makes for an easier read than (String string: strings) and System.out.println vs print

    String[] word_list = {"hat", "dog", "cat"}
    for(String word: wordlist){
        System.out.println(word);
    }
Re:Python is now the most popular introductory language at t... by aikah on Monday July 07, 2014 @06:15PM (#8001879)
My first language was AS3.And I'm glad it was.

Types dont make things more complicated. Most languages have types and I prefer dealing with them explicitely rather than letting an interpreter do random coercion like Javascript.

Types lead to cleaner programming,instead of shoving random stuffs into an untyped list,a dev has to think about data structures.

Furthermore,as a non native english speaker,I dont find python more readable than staticaly typed languages like C# or Java.Especially when a codebase grows larger. I wish python was statically typed.

Re:Python is now the most popular introductory language at t... by zo1 on Monday July 07, 2014 @07:32PM (#8002217)
"Types lead to cleaner programming,instead of shoving random stuffs into an untyped list,a dev has to think about data structures."

You're more than welcome to not think about what types you put into a structure/list. You'll quickly learn how to use that list/structure without hand-holding. For 90% of the problems out there, you don't need anything other than the basic data structures, and they're pretty straightforward to use without having to think about types.

Note. Please don't confuse Javascript's weak-typing with Python's typing, as Python is strongly-typed.

Re:Python is now the most popular introductory language at t... by dragonwriter on Monday July 07, 2014 @07:40PM (#8002240)
> Types lead to cleaner programming,instead of shoving random stuffs into an untyped list,a dev has to think about data structures.

Once you've learned to think about types -- as most introductory courses, even those taught in dynamically typed languages, will teach you -- you can do that just fine in a language that doesn't put a gun to your head and force you to.

(And you can do so in ways that most statically-typed languages have too limited a type system to let you do, too.)

Re:Python is now the most popular introductory language at t... by cma on Monday July 07, 2014 @08:41PM (#8002460)
Python doesn't do random coercion, except bool to int.
Re:Python is now the most popular introductory language at t... by codygman on Monday July 07, 2014 @05:51PM (#8001715)

    mapM_ putStrLn ["hat", "dog", "cat"]
I'd say the above is pretty simple if explained after:

    putStrLn "hello world"
You don't really have to go into Monads for this to be understood/used. You can just leave it at "you use functions ending with an M if they do something like print out to the screen or get stuff from a web page".
Re:Python is now the most popular introductory language at t... by achal on Monday July 07, 2014 @06:11PM (#8001852)
My first reaction to this was that this was definitely less understandable, but I realized there were two pieces to this. One is banal - mapM_ and putStrLn are not near as simple as `for' and `print' (the latter have English meanings directly).

The second piece is interesting: Is something of the sort "<mapfn> <printfn> <list>" easier to explain to someone who's new to programming than "<foreach> <print>"? I've always thought the latter was easier to understand, but I'm curious which one someone who has no previous programming experience would grasp more immediately.

Re:Python is now the most popular introductory language at t... by codygman on Monday July 07, 2014 @07:14PM (#8002156)
Right, I think that once the concept is taught of what mapM does/means it will be easier to keep applying than something like a foreach loop.

The reason being that "<mapfn> <somefn> <list>" is more declarative, whereas the foreach loop is ambiguous. Something we often take for granted is how hard it was at first to come up with what exactly we need to do or mutate inside that loop to build the right result.

If nothing else, there is interesting discussion to be had ;)

Re:Python is now the most popular introductory language at t... by theaeolist on Tuesday July 08, 2014 @06:33AM (#8003825)
This is because of lexical issues. You can define aliases for mapM_ and putStrLn and get something more approachable to the lexically challenged.

repeat print ["foo"; "bar"; "etc"]

Re:Python is now the most popular introductory language at t... by mickle00 on Monday July 07, 2014 @05:39PM (#8001627)
NameError: name 'string' is not defined. :)

print(word) means it's even easier for grandma to understand!

Re:Python is now the most popular introductory language at t... by valarauca1 on Monday July 07, 2014 @05:35PM (#8001592)

     String[] word_list = {"hat", "dog", "cat"};
     for(String a: word_list)
     {
        System.out.println(a);
     }
extra brackets but pretty identical
Re:Python is now the most popular introductory language at t... by EpicEng on Monday July 07, 2014 @06:10PM (#8001848)
Who cares? If I'm a teacher I don't want to have to update material extensively every semester / year because the language is changing rapidly. Three are plenty of good, stable languages to use.
Re:Python is now the most popular introductory language at t... by Igglyboo on Monday July 07, 2014 @07:14PM (#8002155)
So we should teach the students old stuff because it's easier on the teacher? This isn't history, the tech world is changing daily with new languages and technologies being created. Sticking to one curriculum because it's easier on the teacher is ridiculous.
Re:Python is now the most popular introductory language at t... by EpicEng on Tuesday July 08, 2014 @12:34PM (#8005354)
"Old stuff"? No, necessarily, but the stable stuff, yes.
Re:Python is now the most popular introductory language at t... by lmm on Monday July 07, 2014 @06:27PM (#8001957)
Java is about as stable as it gets; that foreach syntax is ten years old. And if your teaching material stuck to the old-style syntax it wouldn't be wrong, it would still work, it's just not as readable as the new style.
Re:Python is now the most popular introductory language at t... by EpicEng on Tuesday July 08, 2014 @12:35PM (#8005361)
Yes, all languages change over time, butrust is still in its infancy and things have not yet settled. You really don't see the difference?
Re:Python is now the most popular introductory language at t... by benjiweber on Tuesday July 08, 2014 @01:29AM (#8003131)
In modern Java(8) it is now

    asList("hat", "dog", "cat").forEach(System.out::println)
Re:Python is now the most popular introductory language at t... by Dewie on Monday July 07, 2014 @05:27PM (#8001537)
To be fair, couldn't you use java's foreach instead of the regular for-loop? It makes things a bit less noisy.