My project for last weekend was to learn how to program in Python. Possibly an ambitious goal for a weekend, but I feel I have a good grasp of the basics.
I didn't find it a hard language to learn, I guess it is designed that way, but being familiar with Groovy and Javascript probably help. I've only written small programs, but here are some thoughts:
I love the syntax and general feel, it feels very 'right'. Most things are done the way I would do them. I like indentation much better than braces and don't miss semi-colons one bit. On the other hand, it is much more readable than Perl. The only things I object to is colons to initiate block statement and pass statements rather than empty blocks, both seem to go against the minimalist syntactic philosophy, and both seem unnecessary.
In fact I love the language. It seems very good at what it sets out to do, much like C and unlike C++. There are very few rough edges, and lots of things that make you go "nice!".
I like the support for first-class functions, lambdas, map, filter, etc. Syntax for lists, slices, list comprehensions, generators, etc. I thought slices could have been used instead of the range() expression.
The jury is still out on yield.
Not using types is liberating in small programs. But my Groovy experience is that I quickly want to use them for documentation once the programs get larger ("just use variable names" you say; OK, I want compiler-checked documentation). Optional/hybrid types are the obvious solution. Maybe it is because I'm too used to C/Java programming.
The inefficient implementation scares the hell out of me. But, intellectually, I know it doesn't matter for 99% of applications, but still... Also I would prefer the implementation was not as obvious to the programmer (in docs as well as reflective code).
I like the duck typing approach to objects. It feels so much more lightweight than implementing interfaces. It makes me think that interfaces could be supported in a typed language much more easily. Not sure how, but something like Donna Malayeri's blend of nominal and structural types could be helpful.
I find the way fields of classes are handled strange: adding fields when they are assigned to fits nicely with the way variables are used, but feels very uncomfortable for fields. I think this is Java/C++ conditioning at work, and I haven't written programs that make use of this facility yet, so I am reserving judgement. It may well be a good idea, but it gives me the creeps.
I like the 'everything is public' philosophy, although I fear that those of a more software engineering bent would be horrified.
In conclusion, I like Python a lot. Of the scripting/dynamic programming languages I've looked at, it is my favourite. I hope to have an opportunity to use it for something serious soon.
And I still have the feeling that there is a huge space for a programming language with some of the dynamic features of a language like Python, combined with a more heavyweight class system (virtual classes) and optional typing to make a very pleasant general purpose language.
nice- my work so far has all been in python; fast to code but it slow to run!
ReplyDelete