Tuesday, 17 January 2006

Beginning Python: From Novice to Professional

Beginning Python: From Novice to Professional: "Re:Totally fresh in programming(Score:5, Insightful)
by Just Some Guy (3352) Alter Relationship on Wednesday January 11, @01:50PM (#14448131)
(http://subwiki.honeypot.net/ | Last Journal: Thursday March 03, @06:24PM)

if you have to modify it, even a little, every time you port it to a new operating system, you can hardly call it 'platform independent'.

Out of curiosity, what other language qualifies as platform independent by your definition? Answer: there isn't one. In the context of what we currently have, today, in 2006, Python is just about as platform independent as anything else.
For a quicker introduction to the language, you might look at the article I wrote [freesoftwaremagazine.com] for Free Software Magazine [freesoftwaremagazine.com]. It's not an in-depth analysis by any means, but should get you acquainted with the basics in under 10 minutes.

It's licensed under the Creative Commons "Attribution-Share-alike" License, so feel free to pass it around if you want to.--

Dewey, what part of this looks like authorities should be involved?"

====================

A few good and free Python books

(Score:4, Informative)
by YA_Python_dev (885173) Alter Relationship on Wednesday January 11, @02:11PM (#14448344)
On the python.org [python.org] site you can find a big list of Python books [python.org].

I suggest:

Good reading.

--
It's just an object. Doesn't mean what you think.


\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Totally fresh in programming(Score:5, Informative)by Rei (128717) Alter Relationship on Wednesday January 11, @01:41PM (#14448041) (http://www.cursor.org/)

Actually, yes, I would definitely recommend it. I started programming before Python (actually started in Basic because it was the only thing I had in 7th grade, then ran as quickly as I could away from it to a real language). However, python is a very easy language to learn and you don't need to deal with any advanced concepts to "make things work".

* You don't have to declare variables
* Code blocks are simply based on how you indent, making it always very legible
* You can easily see what functions are available in a package using dir(), and you can get brief help information on a function by print function.__doc__, from within any python shell.
* Very simple to do things that might take a long time to in lower-level languages - reading contents of files, splitting strings, performing regular expression matches, etc.
* Performance is tolerable for most applications - just don't try to write Quake or physics calculation software in it.
--
"99 dead duelists of Dios on the wall; 99 dead duelists of Dios. Take one's ring, pass it around...."
===============

Re:Totally fresh in programmingScore:5, Interesting) by GalacticCmdr (944723) Alter Relationship on Wednesday January 11, @03:16PM (#14448940)

* You don't have to declare variables
* Code blocks are simply based on how you indent, making it always very legible
These are the two very reasons I dislike python. It is far to easy to have a typo cause problems in the use of a variable. Since you do not have to declare variables if you want striker, but instead fatkey in an increment to strikr then it becomes a problem that can be difficult to find.

Second, any language that requires indenting to signify code blocks is in my mind a great step backwards to the days of Fortran. This makes code blocking too vulnerable to pretty printers and version control methods that may "adjust" indentation.
--
Programming: Its not just a job - its an indenture.
===================

Totally fresh in programming(Score:5, Informative)by gabe824 (772563) Alter Relationship on Wednesday January 11, @01:47PM (#14448093)

My first language was C, learned in a first year university introductory programming course, but when friends have asked me about learning programming I have recommended they start with python and the book How to Think Like a Computer Scientist: Learning with Python http://www.ibiblio.org/obp/thinkCSpy/ [ibiblio.org]. Its available free online. This is a good introductory book with no expectation of prior experience that teaches the ideas behind programming, not just the syntax of the language.
================

Dive into Python

(Score:5, Informative)
by Jazzer_Techie (800432) Alter Relationship on Wednesday January 11, @01:48PM (#14448110)
No discussion of Python literature can be complete without mentioning Mark Pilgrim's Dive into Python [diveintopython.org], which is an excellent way to get to know the Python language. It's free for download in a variety of formats. Two caveats however, being that 1) it hasn't been updated in about a year and a half and 2) it assumes that you already have a pretty good grasp of programming in some other language. But if you've you got some coding experience and want to take a serious look at what Python has to offer, this is a great book full of nice examples (with the code available for download as well).

==================

Totally fresh in programming(Score:4, Interesting)by T.i.m (149429) Alter Relationship on Wednesday January 11, @01:50PM (#14448137) Two years or so ago I made a CS master thesis where I tried to find / create the perfect language and IDE for learning to program. I did a pretty thoroug study of what is available and what is desired in such an environment. And i came to the conclusion that Python is very close to a perfect place to start learning programming.

I starred to make som tweas in the environment and the language but "Unfortunatley" I got a job right after I finished so I didn't have time to finish the projec. In case someone is interested, more information and a manhandle beta can be found at:
http://www.gahnstrom.se/tim/pystarter/ [gahnstrom.se]
Tim
--
Question authorities
===========================================
by Colonel Panic (15235) Alter Relationship on Wednesday January 11, @01:37PM (#14447991)
I would check out How To Program [pragmaticprogrammer.com] by Chris Pine. It's very much for people who have no programming experience.
Also, for a very different, novel and fun approach you should check out Why's Poignant Guide to Ruby [poignantguide.net]. Did I mention it was fun? It's also a great intro for someone who has never programmed before
======================
What I am looking for, is some easy language to either script or program. Would python provide a good starting environment?

Absolutely! I think it's one of (if not the) best languages for new programmers. My main reasons are:

  • It has a very simple syntax.
  • The core language is relatively tiny - there aren't many keywords that you have to learn just to get started.
  • It is strongly, dynamically typed, which means that you can spend more effort on telling your program what to do rather than the nitpicky details of how to do it.

Opinions will vary, of course, but I think that Python is an excellent choice to start with.

Have any of you been at my level, then learned python?

Nope. When I was at your level, I had to learn a lot of really awful languages because the average person didn't have access to the nice ones. I would have loved having something so easy to learn and powerfully expressive at the same time.

--
Dewey, what part of this looks like authorities should be involved
===================
Python seems to be devouring everything these days... even replacing Perl

From Dice.com

Python : 545 matches
Perl: 3809
C#: 3850

Ummm over 1/8 of the demand of Perl or C#
Java: 11856
Java+BEA: 621
So Python is smaller than one specific application servers development requirements.
Python is better than Perl, but in terms of devouring? Its like saying that American Football is devouring other sports around the world.
--
An Eye for an Eye will make the whole world blind - Gandhi
============================

Re:Devouring?

(Score:5, Interesting)
Just to make another useless-but-interesting experiment, I tried the following: Google for:
"written in python": 665,000 hits
"written in perl": 1,140,000 hits
"written in c": 1,500,000 hits
"written in c++": 772,000 hits
"written in c#": 342,000 hits
"written in java": 1,750,000 hits
"written in haskell": 33,600 hits
"written in lisp": 61,400 hits
"written in pascal": 51,800 hits
"written in objective c": 26,800 hits
"written in ruby": 120,000 hitsI'm not sure what this measures, but it's interesting.
:) Python actually did a lot better than I expected.--
No offense, but the older I get, the more ridiculous the whole idea of God becomes.
=====================
by chriss (26574) * Alter Relationship on Wednesday January 11, @01:53PM (#14448170)
(http://teilweise.net/)

Since this is inevitable to pop up, a very simplyfied version (slightly offtopic):

Why not ditch Python and use Ruby (on Rails)? Ruby is a nice language. It looks more like Java (or C or Perl) than Python, so that may be an advantage for those who dislike Pythons whitespace handling (I think it is genius)

  • Rails is a very nice framework for developing database driven web-apps very fast
  • Someone (David Heinemeier Hansson) really cared to make this user/developer friendly. There is good marketing, nice screencasts (although basically smoke and mirrors), good documentation, a well structured central web site, lots of support. All this may be even more important than the technical differences to other platforms like Python.
  • It's hype, so you could easily sell it to management

Why better stick with Python? Most of the hyped features Rails are available on Python too, although not yet in such a nice package. The Turbogears [turbogears.org] folks try this, but in a more pythoniac way. I like it better, since they actually bundled already established products like CherryPy and SQLObject instead of simply writing from scratch. This may not result in a smooth package like RoR, but it is more clearly aimed at the integration of other products.

  • There are tons of modules and documentation for Python out there. So if you come to the point where you want to include other features than those already present in your framework, it will be easier to add them from different sources, because a) there are more and b) integration is a more established process.
  • There has been a lot going on in the RoR aftershock to improve the situation, like discussions about merging the different frameworks (Turbogears/Subway) to create a unified and very powerful platform.
  • There is always a way up in Python with Zope (although this is a beast and documentation is bad, 3.X is much better, but lots of products currently still require 2.X) and integration in J2EE.
  • Python is old. There has not only been one generation of developers whos projects failed, but many. RoR is still in the "early adaptors" phase, where everyone sees the revolution and casualties are accepted. Ruby alone has had a strong following in Japan, but for the rest of the world Rails was the first contact. Wait a year until the "RoR sucks" postings appear, than you'll be much wiser.

Chriss--
memomo.net - brush up your German, French, Spanish or Italian - online and free [memomo.net]-

memomo.net [memomo.net] - brush up your German, French, Spanish or Italian -
For various reasons (more mature stdandard & third party libraries; English docs; real threading support -- this is a big one; etc) Python is a much better general-purpose language than Ruby.
(It's also about twice as fast, but honestly if Ruby is too slow for your project a factor of 2 probably isn't going to save you. Still, speed is a nice bonus.)--
Carnage Blender [carnageblender.com]: Meet interesting people. Kill them.


///////////////////////////////
by hashmap (613482) Alter Relationship on Wednesday January 11, @01:48PM (#14448104)

EXTERIOR: DAGOBAH--DAY

With Yoda strapped to his back, Luke climbs up one of the many thick vines that grow in the swamp until he reaches the Dagobah statistics lab. Panting heavily, he continues his exercises--grepping, installing new packages, logging in as root, and writing replacements for two-year-old shell scripts in Python.

YODA: Code! Yes. A programmer's strength flows from code maintainability. But beware of Perl. Terse syntax... more than one way to do it... default variables. The dark side of code maintainability are they. Easily they flow, quick to join you when code you write. If once you start down the dark path, forever will it dominate your destiny, consume you it will.

LUKE: Is Perl better than Python?

YODA: No... no... no. Quicker, easier, more seductive.

LUKE: But how will I know why Python is better than Perl?

YODA: You will know. When your code you try to read six months from now.

[ Reply to This ] Re:the obligatory Python vs Perl post by ExoticMandibles (Score:4)
///////////

Re:Has to bash on Perl

(Score:5, Insightful)
by Myddrin (54596) Alter Relationship on Wednesday January 11, @01:57PM (#14448202)
(http://www.communitynewsblog.com/)

And, unlike Perl, it's very easy to do complicated things in simple, legible code.

This must mean you aren't able to write legible Perl code. Perl has been making complicated things simple for more than a decade. If you don't know how to write clean code, then your Python will also suck.

Not directed at the parent, but at the Perl-snipping in the original post....

I'm a professional python programmer, and I've been making my living at it for a number of years now. (It was my embracing of python that allowed me to transition to a 100% MS free workspace.) I started using it a project a few years ago, and it's just stuck for a number of reasons. (meta-classes, extensibility, etc.)

One thing that drives me buggy about some python evangelists, (and many evangelists, in general) is the need to bash anything that is not their favorite brand (be it Creative vs iPOD, Python vs (insert any language here). And so on. The fact of the matter is that Perl is a perfectly good language. I don't use it on a regular basis personally, but I've seen, read and understood a good deal of Perl code w/o a hassle. (yes, I've seen some scary code, but I've seen scary code in C++, Python, Java, etc., etc., etc.)

Sometimes we just have to admit that there are multiple good tools that we could use, but we have a personal (and possibly irrational) preference for one over the other. That's life as a human being (which I'm assuming at least 99% of the readers out there are. :) ). Just because some people use Perl, doesn't make my choice of python (of C++, my other "main" language) any less valid.

It's real life, not a multiple choice test -- there is no single "correct" answer.

Ok, I'm done... back to work.--

Myddrin
CommunityNewsBlog [communitynewsblog.com]
===============================================================

Learning Python

(Score:4, Informative)
by kevin_conaway (585204) Alter Relationship on Wednesday January 11, @02:09PM (#14448327)
(http://pyscrabble.sf.net/ | Last Journal: Thursday April 28, @12:48PM)
I am a Java programmer by profession but I wanted to give Python a shot because it seemed like fun.

As a programmer experienced with OO programming and some other types of "scripting" languages, all I needed to read was Learning Python [oreilly.com] from O'Reilly. Great book, great language.

On a shameless side note, if you're a Scrabble fan, come check out my online, multiplayer Scrabble program written in Python. PyScrabble [sf.net]--

Play Scrabble! -- New on 12/20!! [sourceforge.net]
==================
by mrfoos (584110) Alter Relationship on Wednesday January 11, @02:17PM (#14448396)
Comparing to two for me is like comparing tree cutting with building houses.

When you build a house you need an architect and specific design rules so other people in the project can do their part. It takes a long time to build it, and someone has to live in the house a long time.

When you cut down a tree you're only interested in the fastest way possible to get it down safely. Who cares if it's pretty. If you didn't like the way the first one fell, you can make adjustments on the next.

A house builder wouldn't tell a woodcutter which axe to use. He doesn't care. Of course, woodcutters have no business building houses.

Personally? I like being a lumberjack. Nothing like fervorishly hacking away and yelling "TIMBER!" from a safe distance.
==============

Python Riddles

(Score:4, Interesting)
Recently came across pythonchallenge [pythonchallenge.com], it's a notpron/riddle site for learning Python, with each riddle requiring more and more code. Great idea, imho.

As if python itself wasn't fun enough :)==Burn Karma Burn

==============================

Artical summary blows it again.

(Score:4, Insightful)
by Hosiah (849792) Alter Relationship on Wednesday January 11, @07:20PM (#14450669)
(http://wallpaperfree.blogspot.com/ | Last Journal: Saturday November 26, @06:19AM)
And, unlike Perl, it's very easy to do complicated things in simple, legible code.

I just burned through the flamewall on this issue not three days ago. I use Python instead of Perl, love Python best of all languages currently, and may even like the book reviewed. But it is superstitiously ignorant to declare any language makes it "easier" to program in. Can we just once have a discussion of the strengths and weaknesses and merits and demerits of any language at all, instead of talking about it like it was a laxative? "Makes the code soft and it flows out smoothly!" No, it doesn't: nothing does; hard programs are hard to write, easy programs are easy to write. I'll even save the time and copy my closing argument from last time:

I know a secret. It's a secret you only find out after programming for a while. It's one you obviously don't know if you ask me which programming language is the "easiest".

There is this public perception, unanimous in user-land, and even permeating to the very depths of Slashdot, which goes: "Computers are only hard because evil computer programmers deliberately set out to make them hard." And the secret is: that that's a falsehood. Computers are not made artificially difficult. It does no good to tell you this; this is a special kind of secret that you can only learn through experience.

The experience of struggling to design a usable user interface for your own system. The struggle to overcome the barriers of closed systems, lack of documentation, and misinformation everywhere you turn. The exasperation of dealing with users who come to you with the attitude that your program broke on purpose, you should fix it without knowing what the error was, and it's too hard to learn anyway because you make it difficult, because you're "evil".

Programming experience erases that mental line drawn between user and programmer. You get experience on both sides of the fence, and eventually you see that there is no such thing as artificial complication. Interfacing with a machine upon which we have taught electricity to think and where we hope to make it sing and dance for us is inherently complicated TO START WITH, and the various tools we use to perform our tasks - why, each and every one was written by average people like you and me who also sat down with a clean file and furrowed their brow and wondered "How can I do this? How can I make it so people will use it?"

No, you still have that mental mindset that there are programmers who deliberatly design things to be difficult, that it's all in spite, that they're laughing at you. Who, except as a joke, would deliberately make a programming language "hard to learn"? To fail at your task and blame your tool is simply a form of denial so that you don't have to face the fact that you have given up on trying to use something (no matter if it's COBOL or Javascript or Perl or freaking TECO, even!) that hundreds of other people have used successfully.

There is no "easy". There is no "hard". There is only "Task".

Now, you want to talk about an "easy" language? Binary, of course! Binary has just two commands (one and zero) so it's the fastest to learn, has cross-platform compatibility built-in (all computers know binary!), is easiest to test (no compiler or interpretter required, just "Rite 'n' Run"!), is readily available everwhere (ALL programs are "open source" in binary!), and needs no extension libraries (Binary can do it all!). If you thought this paragraph was stupid, this is how stupid the rest of you sound to me when you hyperfocus on "easy" and act like there's no other aspect to programming.

--
Windows - stupidity = Linux

=============
by warewolfe (877477) Alter Relationship on Wednesday January 11, @02:03PM (#14448257)
(http://www.warewolfe.net.nz/)
I've had good experiences with O'Reilly in general, and with "Learning *", "Programming *", and "* Cookbook", where * has been Python, Perl, PHP. However, have a look at http://python.oreilly.com/ [oreilly.com] and download the free chapters and source code before you buy. For an intermediate level programmer you can probably do without the "Learning Python" book. Good Luck.
--
Without context a surgeon is just a masked man with a knife and the intention to cut you open.
--------------------
Run "pychecker" on your python scripts. It catches all sorts of things; certainly almost anything having to do with misspelling.

=================

1 Comments:

Anonymous Anonymous said...

HEY Moralsurgeon [goen ? typo much?] send me a shout at cowtowne at gmail dotcom

17/5/08 10:28  

Post a Comment

<< Home