Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Joseph Lee
Hi Deb and others, Most are for people coming from different languages like C/C++, Java and so on (I myself am coming from C++ world, and can speak both C++ and Python). Unless if you're working on specific things, don't worry about some of the concepts until later (e.g. if you're working on variab

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Joseph Lee
Hi Deb and others, Answers are below. -Original Message- From: Deb Wyatt [mailto:codemon...@inbox.com] Sent: Friday, July 11, 2014 9:51 PM To: Joseph Lee; tutor@python.org Subject: RE: [Tutor] Anti-Patterns in Python Programming Thank you for answering. I used to be a Clipper/dBase p

[Tutor] While loop issue, variable not equal to var or var

2014-07-11 Thread Steve Rodriguez
Hey guys n gals, New to python, having some problems with while loops, I would like to make a program quick once q or Q is typed, but thus far I can only get the first variable to be recognized. My code looks like: message = raw_input("-> ") while message != 'q': s.send(message)

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Deb Wyatt
terns in Python Programming > > Hi Deb and others, > Most are for people coming from different languages like C/C++, Java and > so > on (I myself am coming from C++ world, and can speak both C++ and > Python). > Unless if you're working on specific things, don't worry about some of > the > conce

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-11 Thread Cameron Simpson
On 11Jul2014 20:29, Jim Byrnes wrote: I've worked on this a little more. If I create a file like: #!/usr/bin/python import os, subprocess subprocess.Popen(args=["gnome-terminal", "--working-directory=/home/jfb/Documents/Prog/Python/breezygui"]) and execute it, it will take me to the correct

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Steven D'Aprano
On Fri, Jul 11, 2014 at 01:04:59PM -0700, Audrey M Roy wrote: > Steven, any chance you could clarify how to interpret that section? I'm > assuming it refers to not importing objects that share state across modules? Importing objects that share state across modules was not the problem I was talkin

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Steven D'Aprano
On Fri, Jul 11, 2014 at 09:56:36AM -0700, Alex Kleider wrote: > If the part between a "with" key word and the ":" that follows it is not > an expression (and therefore can not be protected from 'end of line' by > enclosure in parentheses,) what is it? A bug in the parser. And one which is now

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-11 Thread Jim Byrnes
On 07/10/2014 09:23 AM, Jim Byrnes wrote: On 07/09/2014 04:16 PM, Walter Prins wrote: Hi Jim, On 9 July 2014 14:43, Jim Byrnes wrote: On 07/09/2014 04:27 AM, Walter Prins wrote: I forgot to mention I am using Linux (Ubuntu 12.04). I am working my way through a book about breezypythongui

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Deb Wyatt
lurkers and the like http://lignos.org/py_antipatterns/ >> Links of the format https://docs.python.org/3/howto/doanddont.html are >> always up to date, the one you give is by definition 3.1 specific and so >> will never change until such time as it presumably disappears >> completely. >

Re: [Tutor] TypeError: 'int' object is not iterable

2014-07-11 Thread Alan Gauld
On 11/07/14 12:27, Avishek Mondal wrote: for i in range(1, min(n1+n2)+1): TypeError: 'int' object is not iterable shows up. Could you please tell me where I went wrong? Does it mean that if i in an integer, it will not be iterated? But isn't the code for i in range(1, n) a very frequently

Re: [Tutor] TypeError: 'int' object is not iterable

2014-07-11 Thread Mark Lawrence
On 11/07/2014 12:27, Avishek Mondal wrote: Hi, I wrote a simple program, as follows- def finddivisor(n1, n2): divisor = () What's wrong with divisor = [] # a list for i in range(1, min(n1+n2)+1): if n1%i == 0 and n2%i==0: divisor = divisor + (i, ) Then divisor.appen

Re: [Tutor] TypeError: 'int' object is not iterable

2014-07-11 Thread Peter Otten
Avishek Mondal wrote: > Hi, > > I wrote a simple program, as follows- > def finddivisor(n1, n2): > divisor = () > > for i in range(1, min(n1+n2)+1): > if n1%i == 0 and n2%i==0: > divisor = divisor + (i, ) > return divisor > > n1 = eval(input('Enter first number: ')) > n2 = eval(input('Enter sec

Re: [Tutor] how do I set variables in Python 3.4

2014-07-11 Thread Alan Gauld
On 11/07/14 06:50, Danielle Salaz wrote: I'm a noob to Python and cannot figure out how to complete one of my assignments. I am supposed to use operand1=2 and operand2=7 To complete: result= operand1+operand2 etc, but We need more detail. How are you entering your code? Is it using a tool li

Re: [Tutor] how do I set variables in Python 3.4

2014-07-11 Thread William Ray Wing
On Jul 11, 2014, at 1:50 AM, Danielle Salaz wrote: > I'm a noob to Python and cannot figure out how to complete one of my > assignments. > Welcome to Python - I’d hope you’ve been monitoring this Tutor list for at least a few days - > I am supposed to use operand1=2 and operand2=7 > To com

Re: [Tutor] TypeError: 'int' object is not iterable

2014-07-11 Thread Danny Yoo
Hi Avishek: Look at the subexpression within the line that Python says it thinks the error is close to: min(n1 + n2) That looks strange. Take a look at that subexpression again. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subs

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Audrey M Roy
Steven, any chance you could clarify how to interpret that section? I'm assuming it refers to not importing objects that share state across modules? Not being passive-aggressive here, just genuinely seek clarification and want to learn to be a smarter Python user. I'm on this list to learn stuff a

Re: [Tutor] how do I set variables in Python 3.4

2014-07-11 Thread Mark Lawrence
On 11/07/2014 06:50, Danielle Salaz wrote: I'm a noob to Python and cannot figure out how to complete one of my assignments. I am supposed to use operand1=2 and operand2=7 To complete: result= operand1+operand2 etc, but I keep getting invalid syntax either on the " or operand1. Please help

Re: [Tutor] how do I set variables in Python 3.4

2014-07-11 Thread Danny Yoo
> I am supposed to use operand1=2 and operand2=7 > To complete: result= operand1+operand2 etc, but I keep getting invalid syntax > either on the " or operand1. Please help Unfortunately, you've paraphrased the error message enough that we can not reproduce the problem. Since you're emailing on

[Tutor] TypeError: 'int' object is not iterable

2014-07-11 Thread Avishek Mondal
Hi, I wrote a simple program, as follows- def finddivisor(n1, n2):     divisor = ()          for i in range(1, min(n1+n2)+1):         if n1%i == 0 and n2%i==0:             divisor = divisor + (i, )     return divisor n1 = eval(input('Enter first number: ')) n2 = eval(input('Enter second number: '

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Mark Lawrence
On 11/07/2014 16:07, Steven D'Aprano wrote: On Fri, Jul 11, 2014 at 02:26:26PM +0100, Mark Lawrence wrote: This one is also nice: https://docs.python.org/3.1/howto/doanddont.html What timing http://bugs.python.org/issue21956 :( I reject that bug report. The "Do And Don't" article is not pe

[Tutor] how do I set variables in Python 3.4

2014-07-11 Thread Danielle Salaz
I'm a noob to Python and cannot figure out how to complete one of my assignments. I am supposed to use operand1=2 and operand2=7 To complete: result= operand1+operand2 etc, but I keep getting invalid syntax either on the " or operand1. Please help Sent from my iPhone _

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Alex Kleider
On 2014-07-11 08:13, Steven D'Aprano wrote: On Fri, Jul 11, 2014 at 07:39:29AM -0700, Albert-Jan Roskam wrote: > What timing http://bugs.python.org/issue21956 :( :-) But what is 'bad advice' in this document? Does it imply that all document versions should be deleted/pulverized? (including, fo

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Mark Lawrence
On 11/07/2014 15:39, Albert-Jan Roskam wrote: - Original Message - From: Mark Lawrence To: tutor@python.org Cc: Sent: Friday, July 11, 2014 3:26 PM Subject: Re: [Tutor] Anti-Patterns in Python Programming On 10/07/2014 20:06, Mark Lawrence wrote: On 10/07/2014 19:06, Albert-Jan R

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Steven D'Aprano
On Fri, Jul 11, 2014 at 07:39:29AM -0700, Albert-Jan Roskam wrote: > > What timing http://bugs.python.org/issue21956 :( > > :-) But what is 'bad advice' in this document? Does it imply that all > document versions should be deleted/pulverized? (including, for > instance, this one: https://docs.

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Steven D'Aprano
On Fri, Jul 11, 2014 at 02:26:26PM +0100, Mark Lawrence wrote: > >>This one is also nice: > >>https://docs.python.org/3.1/howto/doanddont.html > What timing http://bugs.python.org/issue21956 :( I reject that bug report. The "Do And Don't" article is not perfect, but it is broadly correct. Any s

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Albert-Jan Roskam
- Original Message - > From: Mark Lawrence > To: tutor@python.org > Cc: > Sent: Friday, July 11, 2014 3:26 PM > Subject: Re: [Tutor] Anti-Patterns in Python Programming > > On 10/07/2014 20:06, Mark Lawrence wrote: >> On 10/07/2014 19:06, Albert-Jan Roskam wrote: >>> Just came

Re: [Tutor] Anti-Patterns in Python Programming

2014-07-11 Thread Mark Lawrence
On 10/07/2014 20:06, Mark Lawrence wrote: On 10/07/2014 19:06, Albert-Jan Roskam wrote: Just came across this and thought it might be handy for newbies, lurkers and the like http://lignos.org/py_antipatterns/ This one is also nice: https://docs.python.org/3.1/howto/doanddont.html Links o

Re: [Tutor] How to Create Webpage with Python

2014-07-11 Thread Dave Angel
John Cast Wrote in message: > > will be hosting this (for the foreseeable future at least) on my desktop. There is another python script already written that generates the excel spreadsheets (I did not write this). That script will be ran on a fairly frequent basis so the webpage will constan

Re: [Tutor] How to Create Webpage with Python

2014-07-11 Thread Chris “Kwpolska” Warrick
On Fri, Jul 11, 2014 at 4:07 AM, John Cast wrote: > For future reference (assuming everything else goes well) how do I procure a > more permanent server (i.e. one that doesn't run on my machine so that I can > turn it off and still be able to visit my pages)? I'm hearing Apache and so > forth bei