Re: [Tutor] Which version to start with?

2009-10-06 Thread Ken G.
I am just starting on Python 2.6.2 on Ubuntu 9.04 and I am slightly confused with the numerous tutorials and books available for learning the language. Is there any good recommendation for a good but easy tutorial on the Internet to learn Python? Ken wesley chun wrote: On Mon, Oct 5, 2009

Re: [Tutor] if n == 0 vs if not n

2009-10-06 Thread Wayne
On Mon, Oct 5, 2009 at 3:37 PM, Sander Sweers sander.swe...@gmail.comwrote: Thanks Wesly/Vern for the replies. On Mon, 2009-10-05 at 21:56 +0200, Luke Paireepinart wrote: if not n == 0 if b == True can be written as if b. However, if not n == 0 can be written as if n != 0

Re: [Tutor] Which version to start with?

2009-10-06 Thread Wayne
On Tue, Oct 6, 2009 at 7:59 AM, Ken G. beach...@insightbb.com wrote: I am just starting on Python 2.6.2 on Ubuntu 9.04 and I am slightly confused with the numerous tutorials and books available for learning the language. Is there any good recommendation for a good but easy tutorial on the

Re: [Tutor] Which version to start with?

2009-10-06 Thread Lewis Chuang
As someone who learned (about) programming by copying and pasting code, I really appreciate, Python for software design - how to think like a computer scientist by Allen Downey. It really talks you through the workflow of programming, rather than just give you a long list of things that you

Re: [Tutor] Checking for Python version

2009-10-06 Thread Christian Witts
Didar Hossain wrote: Hi, I am using the following code to check for the Python version - import os t = os.sys.version_info[0:2] if (t[0] + t[1]) 6: os.sys.exit(Need at least Python 2.4) del t This snippet is put at the beginning of the single script file before the rest of the code. I

Re: [Tutor] Checking for Python version

2009-10-06 Thread Wayne
On Tue, Oct 6, 2009 at 9:26 AM, Christian Witts cwi...@compuscan.co.zawrote: Didar Hossain wrote: Hi, I am using the following code to check for the Python version - import os t = os.sys.version_info[0:2] if (t[0] + t[1]) 6: os.sys.exit(Need at least Python 2.4) del t This

Re: [Tutor] Checking for Python version

2009-10-06 Thread Wayne
On Tue, Oct 6, 2009 at 9:46 AM, Steve Willoughby st...@alchemy.com wrote: On Tue, Oct 06, 2009 at 09:42:04AM -0500, Wayne wrote: On Tue, Oct 6, 2009 at 9:26 AM, Christian Witts cwi...@compuscan.co.za wrote: if sys.version '2.4': sys.exit(Need at least Python 2.4) AFAIK the string

Re: [Tutor] Checking for Python version

2009-10-06 Thread Steve Willoughby
On Tue, Oct 06, 2009 at 09:47:43AM -0500, Wayne wrote: On Tue, Oct 6, 2009 at 9:46 AM, Steve Willoughby st...@alchemy.com wrote: On Tue, Oct 06, 2009 at 09:42:04AM -0500, Wayne wrote: On Tue, Oct 6, 2009 at 9:26 AM, Christian Witts cwi...@compuscan.co.za wrote: if sys.version '2.4':

Re: [Tutor] if n == 0 vs if not n

2009-10-06 Thread Dave Angel
Wayne wrote: On Mon, Oct 5, 2009 at 3:37 PM, Sander Sweers sander.swe...@gmail.comwrote: Thanks Wesly/Vern for the replies. On Mon, 2009-10-05 at 21:56 +0200, Luke Paireepinart wrote: if not n == 0 if b == True can be written as if b. However, if not n == 0 can be written

Re: [Tutor] Checking for Python version

2009-10-06 Thread Todd Zullinger
Christian Witts wrote: Your version will fail if the person is running Python 3.0, 3.1 up until the 3.3 series which is not good. Neater looking (imo) code below. from sys import version_info, exit if version_info[0] == 1 or (version_info[0] == 2 and version_info[1] 4): exit(Please

Re: [Tutor] Checking for Python version

2009-10-06 Thread Wayne
On Tue, Oct 6, 2009 at 9:57 AM, Steve Willoughby st...@alchemy.com wrote: On Tue, Oct 06, 2009 at 09:47:43AM -0500, Wayne wrote: On Tue, Oct 6, 2009 at 9:46 AM, Steve Willoughby st...@alchemy.com wrote: On Tue, Oct 06, 2009 at 09:42:04AM -0500, Wayne wrote: On Tue, Oct 6, 2009 at

Re: [Tutor] Checking for Python version

2009-10-06 Thread Dave Angel
Didar Hossain wrote: Hi, I am using the following code to check for the Python version - import os t = os.sys.version_info[0:2] if (t[0] + t[1]) 6: os.sys.exit(Need at least Python 2.4) del t This snippet is put at the beginning of the single script file before the rest of the code. I

Re: [Tutor] Checking for Python version

2009-10-06 Thread Christian Witts
Todd Zullinger wrote: Christian Witts wrote: Your version will fail if the person is running Python 3.0, 3.1 up until the 3.3 series which is not good. Neater looking (imo) code below. from sys import version_info, exit if version_info[0] == 1 or (version_info[0] == 2 and version_info[1]

Re: [Tutor] if n == 0 vs if not n

2009-10-06 Thread Wayne
On Tue, Oct 6, 2009 at 9:58 AM, Dave Angel da...@ieee.org wrote: snip No, because you're not assured that all integers that are equal are the same object. Python optimizes that for small integers, but there's no documented range that you can count on it. But for this specific case -

Re: [Tutor] if n == 0 vs if not n

2009-10-06 Thread Andre Engels
On Tue, Oct 6, 2009 at 5:08 PM, Wayne sri...@gmail.com wrote: On Tue, Oct 6, 2009 at 9:58 AM, Dave Angel da...@ieee.org wrote: snip No, because you're not assured that all integers that are equal are the same object.  Python optimizes that for small integers, but there's no documented range

Re: [Tutor] Checking for Python version

2009-10-06 Thread Luke Paireepinart
On Tue, Oct 6, 2009 at 4:47 PM, Wayne sri...@gmail.com wrote: On Tue, Oct 6, 2009 at 9:46 AM, Steve Willoughby st...@alchemy.comwrote: On Tue, Oct 06, 2009 at 09:42:04AM -0500, Wayne wrote: On Tue, Oct 6, 2009 at 9:26 AM, Christian Witts cwi...@compuscan.co.za wrote: if sys.version

[Tutor] advice on structuring a project

2009-10-06 Thread Serdar Tumgoren
Hi everyone, I was wondering if anyone could offer advice as I try to simplify a project I've been working on. I have a set of classes that I've named models.py (following the Django convention, though it's not technically a Django project or app). Inside that file, I had initially grouped

Re: [Tutor] New to python: some advises for image processing tool

2009-10-06 Thread Nicola De Quattro
Excuse me for the mistake, this list is a little different with respect to Yahoo Groups. Below my comments: Now I think I could begin with some simple script to come into the Python world, so I'll start building the easiest components of final tool (perhaps opening the image and

Re: [Tutor] Which version to start with?

2009-10-06 Thread Jerry Hill
On Tue, Oct 6, 2009 at 8:59 AM, Ken G. beach...@insightbb.com wrote: I am just starting on Python 2.6.2 on Ubuntu 9.04 and I am slightly confused with the numerous tutorials and books available for learning the language. Is there any good recommendation for a good but easy tutorial on the

[Tutor] What language should I learn after Python?

2009-10-06 Thread Mark Young
I'm now fairly familiar with Python, so I'm thinking about starting to learn a second programming language. The problem is, I don't know which to learn. I want a language that will be good for me to learn, but is not so different from python that I will be totally confused. I tried learning C++

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Serdar Tumgoren
Hi Mark, I recently started dabbling with Java, which has some great texts on object-oriented design and patterns (a skill that I'm finding helps with Python). If you have time on your hands, you might want to consider learning a programming language that has a different philosophy or approach

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Che M
programming language. The problem is, I don't know which to learn. I want a language that will be good for me to learn, Good for you in what way? Is there a general good for you for programming, or do you need to achieve a certain goal? From a jobs point of view, Java seems pretty

Re: [Tutor] if n == 0 vs if not n

2009-10-06 Thread Sander Sweers
Thanks all for the informative discussion. To re-confirm it was mostly for boolean checks like if b == True. Greets Sander ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] advice on structuring a project

2009-10-06 Thread Serdar Tumgoren
I don't think there is a right answer to this question. It depends on how the classes are used and related to each other. If the Auto classes are related or if they are useful to more than one client, perhaps you should make an auto_models.py to hold them. If they are only useful to

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Mark Young
I have no real need to learn anything for a job, it's just a hobby right now. I mostly just want a programming language that has a different philosophy or approach than Python. However, you guys are right, if I just learn a language without a reason, it will be worthless. When I tried to learn

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Serdar Tumgoren
Well, it's admirable that you're wiling to stick with it and learn something new. One other resource that I've personally been meaning to look into but just haven't had time is Programming from the Ground Up. It teaches computer science using Assembly language, quite literally from the ground up.

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Serdar Tumgoren
Sorry, forgot the link: Programming from the Ground Up http://savannah.nongnu.org/projects/pgubook/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Luke Paireepinart
On Tue, Oct 6, 2009 at 9:39 PM, Mark Young marky1...@gmail.com wrote: I'm now fairly familiar with Python, so I'm thinking about starting to learn a second programming language. The problem is, I don't know which to learn. I want a language that will be good for me to learn, but is not so

Re: [Tutor] advice on structuring a project

2009-10-06 Thread Kent Johnson
On Tue, Oct 6, 2009 at 2:26 PM, Serdar Tumgoren zstumgo...@gmail.com wrote: I have a set of classes that I've named models.py (following the Django convention, though it's not technically a Django project or app). Inside that file, I had initially grouped together a number of classes,

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Marc Tompkins
On Tue, Oct 6, 2009 at 12:39 PM, Mark Young marky1...@gmail.com wrote: I'm now fairly familiar with Python, so I'm thinking about starting to learn a second programming language. The problem is, I don't know which to learn. I want a language that will be good for me to learn, but is not so

Re: [Tutor] if n == 0 vs if not n

2009-10-06 Thread Kent Johnson
On Tue, Oct 6, 2009 at 11:08 AM, Wayne sri...@gmail.com wrote: On Tue, Oct 6, 2009 at 9:58 AM, Dave Angel da...@ieee.org wrote: snip No, because you're not assured that all integers that are equal are the same object.  Python optimizes that for small integers, but there's no documented

Re: [Tutor] if n == 0 vs if not n

2009-10-06 Thread Kent Johnson
On Tue, Oct 6, 2009 at 9:04 AM, Wayne sri...@gmail.com wrote: If it's checking the returncode against a value, Vern makes a good point: if returncode != 0 makes a whole lot more sense than if not returncode == 0 Though when dealing with an integer return code, doesn't it make more sense to

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Senthil Kumaran
On Tue, Oct 06, 2009 at 03:39:36PM -0400, Mark Young wrote: I'm now fairly familiar with Python, so I'm thinking about starting to learn a second programming language. The problem is, I don't know which to learn. I You have already got a lot of healthy advice in this thread. I would like to

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Mark Young
Ok, thanks alot everybody. I think I'll start with either Scheme or C, I haven't decided yet. I was pleasantly surprised by how Scheme looks, it's much prettier than some other languages I looked at. Contributing to a project actually sounds like a good idea, I've never done a project with other

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Dave Angel
Mark Young wrote: I have no real need to learn anything for a job, it's just a hobby right now. I mostly just want a programming language that has a different philosophy or approach than Python. However, you guys are right, if I just learn a language without a reason, it will be worthless.