Need Help Starting Out
Hi, I would like to start using Python, but am unsure where to begin. I know how to look up a tutorial and learn the language, but not what all technologies to use. I saw references to plain Python, Django, and other things. I want to use it for web building with database access. What do I use for that? Does it matter what I use on the client side (mootools, or whatever)? My rational for using Python is because I am hoping it will allow me to better understand other python programs in other areas, not just web. I have used other languages for web apps for several years. Truth is that I always wanted to learn Python and have heard it was a good thing to know. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Can I run a python program from within emacs?
Hi, I'm trying to learn Python. I using Aquamac an emac implementation with mac os x. I have a program. If I go to the command prompt and type pythong myprog.py, it works. Can the program be run from within the editor or is that not how development is done? I ask because I was using Visual Studio with C# and, if you're familiar, you just hit run and it works. On Python do I use the editor for editing only and then run the program from the command line? Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Can I run a python program from within emacs?
On Mar 20, 11:21 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-03-20, jmDesktop <[EMAIL PROTECTED]> wrote: > > > Hi, I'm trying to learn Python. I using Aquamac an emac > > implementation with mac os x. I have a program. If I go to the > > command prompt and type pythong myprog.py, it works. Can the program > > be run from within the editor or is that not how development is done? > > I ask because I was using Visual Studio with C# and, if you're > > familiar, you just hit run and it works. On Python do I use the > > editor for editing only and then run the program from the command > > line? > > http://www.google.com/search?q=emacs+python > > -- > Grant Gee. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Can I run a python program from within emacs?
On Mar 20, 11:44 am, Jeff Schwab <[EMAIL PROTECTED]> wrote: > jmDesktop wrote: > > On Mar 20, 11:21 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > >> On 2008-03-20, jmDesktop <[EMAIL PROTECTED]> wrote: > > >>> Hi, I'm trying to learn Python. I using Aquamac an emac > >>> implementation with mac os x. I have a program. If I go to the > >>> command prompt and type pythong myprog.py, it works. Can the program > >>> be run from within the editor or is that not how development is done? > >>> I ask because I was using Visual Studio with C# and, if you're > >>> familiar, you just hit run and it works. On Python do I use the > >>> editor for editing only and then run the program from the command > >>> line? > > Sort of. Modern editors generally have support for building and running > your program directly from a toolbar button or textual command. I > personally use Vim with the toolbar disabled, running in a Terminal, and > run the program by first putting Vim in the background (^z). > > People writing code specific to Mac, but not necessarily all in Python, > often use XCode. > > http://zovirl.com/2006/07/13/xcode-python/ > > In the Ruby community, Vim is the dominant choice, but a lot of Mac > users swear by TextMate. > > http://macromates.com/ > > >>http://www.google.com/search?q=emacs+python > > Gee. Thanks. > > I believe Grant was suggesting that Emacs often serves a similar purpose > on Unix to what Visual Studio does on Windows, which seemed to be what > you were asking. When asking about Mac OS X here, you are likely to get > a lot of generic Unix responses. (Would it have been clearer if he had > just said "emacs?") No. Typically when someone posts a one-liner search it means go figure it out and stop bothering "us." I had already searched. I could not get it to work, which is why I posted. If I took it wrong I apologize. I really had two questions. One is just how to run a program from within the editor and the other is if my thinking on how development is done in python wrong to start with. Most of my non-Windows programs have been on Unix using vi, but it has been a while. I'm used to writing a program in visual studio and running it. If that's the wrong expectation for python programming in emacs, then I wanted to know. Thanks for your help. -- http://mail.python.org/mailman/listinfo/python-list
Do any of you recommend Python as a first programming language?
For students 9th - 12th grade, with at least Algebra I. Do you think Python is a good first programming language for someone with zero programming experience? Using Linux and Python for first exposure to programming languages and principles. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Is IronPython real Python?
I know that IronPython and CPython are different in that one does not use the .net framework, but are they both really the same Python language. From my basic understanding, it will depend on what the programmer's goal is as to which of the two would be used, but I didn't know if they were really the same language. -- http://mail.python.org/mailman/listinfo/python-list
Is the Python for statement the same as for each in other languages?
Thank you. It looks like it is, but I wanted to make sure I understood. Also, I didn't see a "regular" for loop construct either (i=0;i<=10;i++), etc. I'm still new at it, but is there one of those? -- http://mail.python.org/mailman/listinfo/python-list
I am worried about Python 3
I am a new Python programmer. I have always desired to learn Python, but have never had the opportunity. Recently this has changed, and I have an opportunity to get away from the .NET framework. I found Django (and other web frameworks) and began my quest to learn. I started reading Dive Into Python and anything I could find and started participating here in usenet. Then I had to read this: http://www.comp.leeds.ac.uk/nde/papers/teachpy3.html I think that every time I start a new technology (to me) it is about to change. Yes, I know that is the nature of things, but I'm always at the start of "something new." If I continue in Python 2.5.x, am I making a mistake? Is it really that different? Here is an excerpt that is causing me concern: Two new versions of the language are currently in development: version 2.6, which retains backwards compatibility with previous releases; and version 3.0, which breaks backwards compatibility to the extent that even that simplest of programs, the classic 'Hello, World', will no longer work in its current form. It makes me feel like I am wasting my time and makes it difficult to justify spending time on projects using 2.5.x and using it where I work. -- http://mail.python.org/mailman/listinfo/python-list
basic python question about for loop
>From the Python.org tutorial: >>> for n in range(2, 10): ... for x in range(2, n): ... if n % x == 0: ... print n, 'equals', x, '*', n/x ... break ... else: ... # loop fell through without finding a factor ... print n, 'is a prime number' ... 2 is a prime number 3 is a prime number 4 equals 2 * 2 5 is a prime number 6 equals 2 * 3 7 is a prime number 8 equals 2 * 4 9 equals 3 * 3 first time 2 mod 2, 2/2, no remainder == 0, what am I doing wrong? Why did it fall through? http://www.python.org/doc/current/tut/node6.html#SECTION00630 Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: basic python question about for loop
On Apr 9, 4:58 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > jmDesktop schrieb: > > > > > > > From the Python.org tutorial: > > >>>> for n in range(2, 10): > > ... for x in range(2, n): > > ... if n % x == 0: > > ... print n, 'equals', x, '*', n/x > > ... break > > ... else: > > ... # loop fell through without finding a factor > > ... print n, 'is a prime number' > > ... > > 2 is a prime number > > 3 is a prime number > > 4 equals 2 * 2 > > 5 is a prime number > > 6 equals 2 * 3 > > 7 is a prime number > > 8 equals 2 * 4 > > 9 equals 3 * 3 > > > first time 2 mod 2, 2/2, no remainder == 0, what am I doing wrong? > > Why did it fall through? > > print out what range(2, n) for n == 2 is. > > And if you didn't know - 2 *IS* a prime. > > Diez- Hide quoted text - > > - Show quoted text - I do not understand. -- http://mail.python.org/mailman/listinfo/python-list
Re: basic python question about for loop
On Apr 9, 4:59 pm, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:python- > > [EMAIL PROTECTED] On Behalf Of jmDesktop > > Sent: Wednesday, April 09, 2008 4:51 PM > > To: [EMAIL PROTECTED] > > Subject: basic python question about for loop > > > >From the Python.org tutorial: > > > >>> for n in range(2, 10): > > ... for x in range(2, n): > > ... if n % x == 0: > > ... print n, 'equals', x, '*', n/x > > ... break > > ... else: > > ... # loop fell through without finding a factor > > ... print n, 'is a prime number' > > ... > > 2 is a prime number > > 3 is a prime number > > 4 equals 2 * 2 > > 5 is a prime number > > 6 equals 2 * 3 > > 7 is a prime number > > 8 equals 2 * 4 > > 9 equals 3 * 3 > > > first time 2 mod 2, 2/2, no remainder == 0, what am I doing wrong? > > Why did it fall through? > > a) 2 is prime, so nothing is wrong. > > b) Range isn't doing what you think it's doing: > > >>> print range(2,2) > [] > >>> print range(2,3) > [2] > >>> print range(2,4) > [2, 3] > >>> print range(2,5) > > [2, 3, 4] > > > > >>> print range(1,1) > [] > >>> print range(1,2) > [1] > >>> print range(1,3) > [1, 2] > > * > > The information transmitted is intended only for the person or entity to > which it is addressed and may contain confidential, proprietary, and/or > privileged material. Any review, retransmission, dissemination or other use > of, or taking of any action in reliance upon this information by persons or > entities other than the intended recipient is prohibited. If you received > this in error, please contact the sender and delete the material from all > computers. GA622- Hide quoted text - > > - Show quoted text - So what is n and x in the first iteration? Sorry. I'm trying. -- http://mail.python.org/mailman/listinfo/python-list
Is 2006 too old for a book on Python?
Hi, I wanted to buy a book on Python, but am concerned that some of them are too old. One I had come to after much research was Core Python by Wesley Chun. I looked at many others, but actually saw this one in the store and liked it. However, it is from 2006. I know there is free documentation and Dive Into Python. I just liked the one in question and was hoping for thoughts on the age of it. I am using Python 2.5.x and don' t know how different 2.3, 2,4 is from it. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Simple import question about mac osx
Hi, I have this code (learning from Core Python, Chun's book), module named chap2.py. class FooClass(object): version=0.1 def __init__(self, nm='John Doe'): self.name=nm print 'Created a class instance for ', nm def showname(self): print 'Your name is', self.name print 'My name is', self.__class__.__name__ On Windows, if I compile this and then in the python interpreter type: >>> import chap2 >>> foo1=FooClass() Created a class instance for John Doe >>> If I do the same think on my Mac OS X 10.5.2 NameError: name 'FooClass' is not defined. I thought it was the path and did export PATH=$PATH:/mypath/ topythoncode but it did not help. What am I doing wrong? Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple import question about mac osx
On Apr 29, 1:16 pm, jmDesktop <[EMAIL PROTECTED]> wrote: > Hi, I have this code (learning from Core Python, Chun's book), module > named chap2.py. > > class FooClass(object): > version=0.1 > > def __init__(self, nm='John Doe'): > self.name=nm > print 'Created a class instance for ', nm > def showname(self): > print 'Your name is', self.name > print 'My name is', self.__class__.__name__ > > On Windows, if I compile this and then in the python interpreter type: > > >>> import chap2 > >>> foo1=FooClass() > > Created a class instance for John Doe > > > > If I do the same think on my Mac OS X 10.5.2 > > NameError: name 'FooClass' is not defined. > > I thought it was the path and did export PATH=$PATH:/mypath/ > topythoncode > > but it did not help. > > What am I doing wrong? Thank you. forgot to say that on the mac I can do import chap2, but when I try and instantiate I get the error above. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple import question about mac osx
On Apr 29, 1:54 pm, [EMAIL PROTECTED] wrote: > On Apr 29, 12:46 pm, jmDesktop <[EMAIL PROTECTED]> wrote: > > > > > > > On Apr 29, 1:16 pm, jmDesktop <[EMAIL PROTECTED]> wrote: > > > > Hi, I have this code (learning from Core Python, Chun's book), module > > > named chap2.py. > > > > class FooClass(object): > > > version=0.1 > > > > def __init__(self, nm='John Doe'): > > > self.name=nm > > > print 'Created a class instance for ', nm > > > def showname(self): > > > print 'Your name is', self.name > > > print 'My name is', self.__class__.__name__ > > > > On Windows, if I compile this and then in the python interpreter type: > > > > >>> import chap2 > > > >>> foo1=FooClass() > > > > Created a class instance for John Doe > > > > If I do the same think on my Mac OS X 10.5.2 > > > > NameError: name 'FooClass' is not defined. > > > > I thought it was the path and did export PATH=$PATH:/mypath/ > > > topythoncode > > > > but it did not help. > > > > What am I doing wrong? Thank you. > > > forgot to say that on the mac I can do import chap2, but when I try > > and instantiate I get the error above. > > It shouldn't work under Windows, either. You have to qualify the name > of the class with the name of the module, as in chap2.FooClass(). Or > you can type "from chap2 import FooClass" and then you'll be able to > simply say FooClass().- Hide quoted text - > > - Show quoted text - Thanks. That worked on mac. But it does work like I said in Windows. Don't know why. Mr. Chun must also be using Windows because that is the way he does it in his book. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple import question about mac osx
On Apr 29, 2:37 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 2:14 PM, jmDesktop <[EMAIL PROTECTED]> wrote: > > Thanks. That worked on mac. But it does work like I said in > > Windows. Don't know why. Mr. Chun must also be using Windows because > > that is the way he does it in his book. > > It shouldn't work that way on windows either. Can you tell us a > little more about what you mean when you say you "compile this" under > windows? Normally, python code doesn't need to be compiled, so I'm > wondering if you're doing something different from what we expect when > you say you compile it and then import it in the interpreter. > > Are you by any chance writing code in IDLE, running it, then doing > things in the interpreter? > > -- > Jerry On Windows I took the text file I created on mac with vi and opened it in PythonWin. I ran it. It compiled. I run the import and call from the python interpreter. -- http://mail.python.org/mailman/listinfo/python-list
simple beginner question about lists and negative index
This program: s = 'abcde' i = -1 for i in range (-1, -len(s), -1): print s[:i], i gives abcd -1 abc -2 ab -3 a -4 Why doesn't the first one have the e if -1 is the end of the list? In Dive Into Python it said that -1 was the end of the list. Thanks. it is from Chun's book, slightly modified by me to see the index. -- http://mail.python.org/mailman/listinfo/python-list
Re: simple beginner question about lists and negative index
On May 1, 10:59 am, jmDesktop <[EMAIL PROTECTED]> wrote: > This program: > > s = 'abcde' > i = -1 > for i in range (-1, -len(s), -1): > print s[:i], i > > gives > > abcd -1 > abc -2 > ab -3 > a -4 > > Why doesn't the first one have the e if -1 is the end of the list? In > Dive Into Python it said that -1 was the end of the list. Thanks. > > it is from Chun's book, slightly modified by me to see the index. Sorry. It's because of the : right? up to but not including. Dive into was just list[-1] not list[:-1]. I looked at the for while before posting and then as soon as I posted I saw it. -- http://mail.python.org/mailman/listinfo/python-list
where do I begin with web programming in python?
I have been to the main python site, but am still confused. I have been using .net, so it may be obvious how to do this to everyone else. I am aware there are various frameworks (Django, Pylons, etc.), but I would like to know how to create web pages without these. If I have mod_python or fastcgi on apache, where do I start? I don't have clue where to begin to create a web page from scratch in python. I am sure I will want to access database, etc., all the "normal" stuff, I just want to do it myself as opposed to the frameworks, for learning. Thank you for any help. -- http://mail.python.org/mailman/listinfo/python-list
Am I missing something with Python not having interfaces?
Studying OOP and noticed that Python does not have Interfaces. Is that correct? Is my schooling for nought on these OOP concepts if I use Python. Am I losing something if I don't use the "typical" oop constructs found in other languages (Java, C# come to mind.) I'm afraid that if I never use them I'll lose them and when I need them for something beside Python, I'll be lost. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Am I missing something with Python not having interfaces?
On May 6, 10:26 am, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-05-06, jmDesktop <[EMAIL PROTECTED]> wrote: > > > Studying OOP and noticed that Python does not have Interfaces. Is > > that correct? Is my schooling for nought on these OOP concepts if I > > Depends on your definition of 'Python does not have Interfaces'. They are not > in the official language, but they do exist. look into zope.interfaces, > athttp://www.zope.org/Products/ZopeInterface. > > > use Python. Am I losing something if I don't use the "typical" oop > > constructs found in other languages (Java, C# come to mind.) I'm > > I think you are still thinking with a Java mind-set (no idea about C#, never > programmed with it). > > Interfaces mainly exist to formalize TO A COMPILER that an object will provide > certain stuff. In this way, the compiler can catch such errors at compile > time. > > Python on the other hand does very little at compile time (other than parse > errors). Instead, at run-time it performs the checks that something you want > to > use is actually there. > (in the same way that you don't declare variables a priori. You simply use > them > and Python creates them for you when needed). > > As a result, you get much more light-weight, more dynamic, code, which > supports > the RAD nature of Python what makes it so much more productive. > > (after a few years Python, you may find the Java way of doing things clunky). > > > afraid that if I never use them I'll lose them and when I need them > > for something beside Python, I'll be lost. Thank you. > > You can continue doing everything exactly in the way you do now. Effectively > you would then be programming Java/C# in Python syntax. I believe you would > gain very little by that move. > > If you dare let go of your old habits, and embrace the mindset of a new > language, you can learn a lot more, namely that programming can be done in > many > different ways (even if all those ways are called OOP). > If you only have a hammer, the whole world looks like a nail. If you have a > whole toolbox, problems become much more diverse (subtle). You learn to use > the right tools for the right problem, and maybe you find new (better) ways of > approaching old problems. > > In the process, you may lose details of how something was done in language X, > but that's why they have invented books. > > Sincerely, > Albert I would imagine this is why I haven't found any schools teaching Python in their basic programming classes too. On the dynamic typing, isn't that the same sort of thing that lots of scripting languages do? VBScript doesn't require you to define your variables, but I don't really want to use it for anything (used to use it a lot in Classic ASP.) I believe everyone that Python is great, but some of it doesn't make sense to me as to why. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
