The depth and breadth of Python
neopythonic.blogspot.com
neopythonic.blogspot.com
Programming languages are meant for programmers. A survey of non-programmers on programming would be something on the lines of non-math people on math symbols.
So in both cases, it'd be extremely useful.
Professional mathematicians and professional programmers are small groups. They're surrounded by very many people who do a bit of math or a bit of code to get things done. Helping them is extremely valuable.
Assume all those surveyed say they don't like what they see in Mathematics at all - its all greek symbols and stuff. And then we do what? The current practices have originated from long research and its the best we have right now. For beginners, things are simplified in both programming and mathematics.
Technically true, but only in the sense of "have originated as a side effect of long research in other things", rather than "have originated from long research into the most efficient or easily understood practices".
Agreed. But judgement can't be passed on efficiency and/or clarity based on opinions of people who don't follow the trade.
If we are talking about Mathematics, its going to look strange to people who don't follow it. Weird symbols and horrifying looking formulae are the most efficient and clear form of describing Mathematics - and its actually pretty clear to people who follow them.
Go to Adobe and get them to create the ColdFusion equivalent for Mathematics!
There always is room for improving mathematics or programming or anything for that sake. But why not aim at converting the non-programmers to programmers(which takes work - a lot of work) and then working at optimizing programming for programmers? It seem like a better option than transforming programming to suit non-programmers.
Which suggests a correlation between a language being easy for beginners to learn and being productive for advanced coders.
If we are talking non programmers, I am afraid this close mapping would mean anything to them. Isn't it more or less about how similar programmers find the pseudo-code and the implementation?
For some programmers, their 'executable pseudocode' language is Haskell, or Forth, or maybe even the assembly language of some specific piece of hardware. Some people might naturally think in COBOL.
Also, the problem domain can dictate some of the shape of the language: Something that's built out of a mathematical expression is almost always going to be expressed most compactly as that expression in standard mathematical notation, with something like APL coming close to being the 'executable pseudocode' form of that program. That said, there are almost always many ways to solve the same problem.
So even in one person, it can vary.
Python already has something accessible and similar in it's tuple unpacking. For example it allows:
a,b,c = (1,2,3)
Here the variables are being filled by values from the tuple based purely on their position within it.
Pattern matching takes this a few steps further by allowing you to mix known values into things and combine dispatch from those values with variable assignment.
For example, imagine that Python had the following Python expression give a true/false value based on if the elements match:
"test", a, b = ("test", 1, 2) # would evaluate to True and bind a=1, b=2
"test", a, b = ("nope", 1, 2) # would evaluate to False and would not bind a or b
This can clean up a surprising amount of code, especially if you structure a case statement around it.
The double-whammy is when you allow a function to be defined multiple times so long as each definition has a different pattern match in the variable declaration. The Erlang article I linked to covers this topic pretty well.
http://learnyousomeerlang.com/syntax-in-functions
You can think of it as a smart way of doing a switch statement that takes the number and type of arguments in to account - though that's a huge simplification.
E.g.: foo(0) -> 1; foo(n) -> foo(n) * foo(n-1).
calls to foo(0) would execute the first function, while all other calls would execute the 2nd. Note that it is often necessary to define the functions in order of most specific first.
A similar concept in Erlang is guards, where an expression can be evaluated instead of simple pattern matching.
foo(n) where n == 0 -> 1; foo(n) -> foo(n) * foo(n-1).
Might have screwed up on the Erlang notation in that example though.
If any of the Dropbox folks are around, why not wxPython everywhere? Why the switch to the PyObjc?
http://groups.google.com/group/wxpython-users/browse_thread/...
Yes I know, Python has a fairly decentralized control structure and a nice open process in the form of PEPs. There was just something about this post that made me a bit uncomfortable...scratching phantom itches from old, somewhat exotic languages...
Pattern matching in list comprehensions would be awesome too. List comprehensions are very cool in Python but they're so much cooler in Haskell :)
The Boo programming language is heavy influenced by Python, but includes static typing and type inference. Unfortunately, Boo requires the .NET Runtime.
/probably obvious to all you actual dropbox users
Link in question is: http://files.dropbox.com/u/2/app.html
Original submission: http://news.ycombinator.com/item?id=801503
Thanks in advance! Dropbox is really an amazing product, even to techies.