Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Wednesday, February 25, 2009

Thanks to datainadequate's comment on an earlier post, I've got another book to take a look at - Dive Into Python. I did see mention of it before, but the tag line saying it was 'for experienced programmers' scared me off without looking at it further. What the heck, I'm game this time around.

Also of note, I'm hoping to have current versions of both O'Reilly books Learning Python and Programming Python in my posses ion soon, so once my eyes quit glazing over from the information overload I'll try and post some further reviews of how I think they all stack up.

Maybe I should have been a librarian :-) I wonder if librarians that like too read too much end up like cooks that like to eat too much....

Wednesday, February 4, 2009

A Space In The Right Place Saves Nine

Experienced programmers please set down any hot liquids before proceeding. The following comments are from a beginning programmer, and as such, will likely promote laughter among those who know better. That's why I'm writing this - you guys just can't regress all the way back to this level of ignorance easily :-)

The one thing everybody knows about Python is that whitespace is significant, and it's really a pain. OK, so now that I can do 'Hello World' in three - count 'em three! - different scripting languages, what do I think about Python syntax?

I just don't see why everybody thinks it's hard. To me, it's a breath of fresh air! So far, the only time I've seen that white space matters is leading whitespace to set off a block of statements.
There's no 'end' to that block except the ending of the indentation. OK, so it's something to keep in mind. On the other hand, bash's use the $ when you assign the value and not when you use it is a lot more confusing. And don't get me started on Perl. When to use a ( vs a { vs a [ is a lot harder to figure out, and $ or % or @ for variables ain't exactly simple either. Yes, Perl logically hangs together, and I get the fact that you should know which symbol to use when based on what you are trying to do, and what kind of data you are storing. I even appreciate the fact that it's a form of error checking - because if you use the wrong symbol because of a logical error it'll catch it for you.

On the other hand, in Python a variable is a variable regardless of the contents. The programmer has to keep it straight in his head rather than the syntax enforcing it. It might make things more error prone, but it sure makes it easier to read. The lack of end of line characters in particular is refreshing, unlike bash's 'you might want to use a semi-colon here - or not...

So, if you were thinking that counting spaces was a necessary evil in Python, forget it, and just try it out and see what you think!

Sunday, February 1, 2009

How's It Going?

When we last saw our brave hero, he'd just emerged victorious from his struggle over the dog pack of FLOSS project hosting choices, but the looming battle against the three headed dog of Python, Bazaar and Object Orientated Programming was yet to begin.... Will he survive to see another day?

Sorry - Rocket Robin Hood flashback. Thanks Teletoon Retro....

Just a quick update on where I'm at. I've set up a project on Launchpad. That was a straightforward click n' drool kinda thing. Just fill in the blanks where required. I spent some very constructive time reading the documentation. It's got lots of information on all the various Launchpad features (and there are quite a few) but I was most struck by the amount of 'why' as well as 'how' in the information. Since I've not been exposed to project management per se before, it was good for me to see how the website was designed around a project flow, rather than the other way around, and expose me to the common steps most projects go through.

I had already registered my GPG key when I signed the code of conduct earlier, so I just had to create and upload an ssh key for use with bazaar. It took me a bit of twiddling to get that working, mainly because I wanted a separate launchpad key from my regular ssh key. My regular key is already used in too darned many places. The twiddling was purely self inflicted - launchpad was working perfectly all along :-)

Next up, I went looking for some docs to get me started on learning Python. A quick inquiry in the (newly created) Python group on identi.ca pointed me at 'A Byte of Python'. Turns out it's licensed CC and available for download.

As I work my way through the examples, I've been creating the them in GVim. Another bit of Googling followed with an identi.ca query found me some pointers for using Python in Vim. As I've created each example and tested them, I've committed them to a +junk repository and pushed it up to Launchpad. This post by Paul Hummer made getting that all set up painless and simple.

Are you seeing a trend here? I'm using Linux, SSH, GPG, GVim, Identi.ca, Python, A Bite of Python, and a blog posting by a Launchpad dev. All of it FLOSS. All of it no charge. All of it quality information and tools - downloaded off the internet by nothing more than the sweat of my little pinkies. It's just amazing when you sit back and think about it. It's downright flippin' awesome in fact.

Thank you one and all that made this happen, and continue to make it happen. Hopefully I can do my little part too, and keep the steamroller rolling.

Thursday, January 15, 2009

Running In All Directions At Once

So, since I claimed I was interested in other things lately, what the heck am I going to put on this blog? Other stuff of course :-)

Here's one topic I'll be returning to again and again. I might finally stop saying "I'm not a programmer". I can't go back to school (unless somebody's willing to foot the bill) but I can try and figure this out on my own. Lots of people do it every day. I don't expect to get really good at it, but hey - who knows?

I'm starting for that old open-source traditional reason - I've got an itch to scratch.

I do know a smidgen of bash scripting and Perl. I even did a complete website from scratch using Perl and MySQL with a bit of help from a friend. The problem I find with Perl is the same thing pointed out in one of the Perl books I read. If you don't do Perl every day and really work at, it doesn't seem to 'stick' with you that well. When I go back and look at old work, I have to really stop and look at it to figure out what's going on. To boot, the whole 'object orientated programming' paradym didn't make all that much sense to me in Perl either.

My itch is actually to contribute some code to an existing project. It does a lot of what I want, but not all of it. I've even posted my ideas to their bug tracker, but it doesn't seem like anybody else is going to do the work for me, so maybe it's time I tried to do it myself. That project is written in Python, and Python should be a good thing to learn for lots of reasons.

Python has the reputation as being easy to learn, and very versatile. Lots of modules and add ons are already out there, and it runs on Linux, Mac and Windows. I've seen lots of interesting end user programs that are written in Python, and I might be able to get something that looks good as well as working well.

So, I need to learn Python. And revision control. And project management. And lots of other things too :-)

I'll post tidbits as I go along here, and I'll start tagging these blog entries better so my mythical audience can skip the parts they don't care about.