A few days ago I got my first Python project. I’d like to share references I’ve found, and what I like or dislike about the language. I hope to give insight to would-be Python dabblers and ideas to current Pythoneers.

Good resources I’ve found

I have found some good resources online for Python and Jython, but I know I didn’t find them all so if you Python-istas could put some in the comments I’d be very grateful :)

What I like so far

I like that a lot of common operations are very easy. Take for example:

# 3 Hellos in Python hellos = 'Hello ' * 3

as opposed to

// 3 Hellos in Java String hellos = "" ; for ( int i = 0 ; i < 3 ; i ++) { hellos += "Hello " ; }

There are a bunch of other features that come to mind, like string formatting, list manipulation, and variable and default-valued arguments. Oh, and of course closures are very straightforward:

def outer ( your_name ): title = random . choice ([ "Mr" , "Mrs" , "Miss" ]) def greeter ( greeting ): print greeting , title , your_name return greeter g = outer ( "Eric" ) # invoke it # g now contains a reference to the inner function, but as it references variables # from the local scope of outer, the invocation data has been stored in a closure # Execution of outer is finished, but g can still reference its local variables through # the closure: g ( "Hi" ) # prints "Hi Mr. Eric" :D

I could go on and on, but you really ought to read the documentation to see all of its features. Actually there’s not all that much to it!

Troubles I have with it

I wish I could find more documentation with simple code examples. I’m sure there are a bunch of blog posts out there but it’d be nice if there were more included with the documentation.

Passing arguments by reference doesn’t seem to be possible, which is fine, but different. I’m not totally used to the lack of curly braces, but I like the fact that you must have good formatting to have runnable Python. I was surprised to learn that Python is strongly typed which in some way I think is odd because it seems like it’d be simpler if it was weakly typed.

a = "17" b = 25 print a + b # Nope!

One last thing is classes. I’m not sure I have my head around how they really work in Python. I’m sure I’ll get the hang of it soon.

Conclusion

Overall I’m thoroughly impressed with the language. There almost seems to be a Zen-like aura around Python code that is written with the simplicity the language creators intended.

Obviously I still have a lot to learn, so please help me out if you have some advice in the comments!