Re: [Tutor] Clunky Password maker

2011-05-25 Thread naheed arafat
On Wed, May 25, 2011 at 11:25 PM, Wolf Halton wrote: > Is there a less clunky way to do this? > [code] > def new_pass(): > series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', > '=', \ > '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', > '+', \ >

Re: [Tutor] PI

2011-05-25 Thread memilanuk
On 05/25/2011 09:21 PM, David Merrick wrote: How do I can access to the math module to use PI? area = math.pi * pow(3,2) Traceback (most recent call last): File "", line 1, in area = math.i * pow(3,2) NameError: name 'math' is not defined try 'import math' first... __

[Tutor] PI

2011-05-25 Thread David Merrick
How do I can access to the math module to use PI? area = math.pi * pow(3,2) Traceback (most recent call last): File "", line 1, in area = math.i * pow(3,2) NameError: name 'math' is not defined -- Dave Merrick merrick...@gmail.com Ph 03 3423 121 Cell 027 3089 169 _

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-25 Thread Wayne Werner
On Wed, May 25, 2011 at 10:17 PM, Rachel-Mikel ArceJaeger < arcejae...@gmail.com> wrote: > You asked for the traceback. All I get is this: > - > > python a2.py > File "a2.py", line 20 > titles = [title in myFile if title not in ["\n",""]] > > ^ > SyntaxError: invalid synt

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-25 Thread Rachel-Mikel ArceJaeger
You asked for the traceback. All I get is this: - python a2.py File "a2.py", line 20 titles = [title in myFile if title not in ["\n",""]] ^ SyntaxError: invalid syntax -- (In c

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-25 Thread Wayne Werner
On Wed, May 25, 2011 at 3:59 PM, Rachel-Mikel ArceJaeger < arcejae...@gmail.com> wrote: > Thank you so much for taking the time to comment this all out. It was very > very helpful and showed me improvements to some coding styles I have been > doing for years. I have a couple of questions, though:

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-25 Thread Alan Gauld
"Rachel-Mikel ArceJaeger" wrote I'm not sure I like this one much... def rank( randomizedTitles, dictOfTitles ): """ Gets a user-input ranking (0-10) for each line of text. Returns those rankings """ for title in randomizedTitles: while True:

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-25 Thread Prasad, Ramit
>>> I'm not quite certain I understand. When you say sections, do you mean >>> different worksheets? If so, you should finish writing on one worksheet >>> first, and then move to another. If you're talking about writing to row 5, >>> and then jumping to row 50, enumerate lets you do that by allo

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-25 Thread Rachel-Mikel ArceJaeger
I'm not quite certain I understand. When you say sections, do you mean different worksheets? If so, you should finish writing on one worksheet first, and then move to another. If you're talking about writing to row 5, and then jumping to row 50, enumerate lets you do that by allowing you to dete

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Wolf Halton
Now I see. I am going to go woodshed this. Thanks y'all for all the cool ideas! Wolf On May 25, 2011 4:05 PM, "Adam Bark" wrote: > On 25/05/11 19:54, Modulok wrote: >> Depending on what your passwords are going to be protecting, be aware that the >> default generator in the random module is: >>

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-25 Thread Prasad, Ramit
>> Having lots of += hanging around is a perfect example of a code smell (i.e. >> something in this code stinks, and we should change >>it). Part of being a >> good programmer is learning to recognize those bad smells and getting rid of >> them. Turns out, Python has a lot >>of nice built-in fun

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Adam Bark
On 25/05/11 19:54, Modulok wrote: Depending on what your passwords are going to be protecting, be aware that the default generator in the random module is: "...completely unsuitable for cryptographic purposes." If he's just planning on making a few passwords I think the period of 2**19937-1 of

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Alan Gauld
"Wolf Halton" wrote Is there a less clunky way to do this? def new_pass(): series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', \ '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', \ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Modulok
On 5/25/11, Wolf Halton wrote: > Is there a less clunky way to do this? > [code] > def new_pass(): > series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', > '=', \ > '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', > '+', \ > 'q', 'w', 'e'

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Martin A. Brown
Hello, : Is there a less clunky way to do this? Yes. There are probably many ways to do this, and this is just something I cooked up at a moment's notice in reply to your question, and probably could be significantly improved upon. : def new_pass(): Your function takes no arguments. Mayb

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Sander Sweers
On Wed, 25 May 2011, 19:25:59 CEST, Wolf Halton wrote: > [code] > def new_pass(): >        series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', > '=', \ >                            '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', >')', '_', > '+', \ >                         

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Noah Hall
On Wed, May 25, 2011 at 6:25 PM, Wolf Halton wrote: > Is there a less clunky way to do this? > [code] > def new_pass(): >     series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', > '=', \ >               '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', > '+', \ >       

[Tutor] Clunky Password maker

2011-05-25 Thread Wolf Halton
Is there a less clunky way to do this? [code] def new_pass(): series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', \ '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', \ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '

[Tutor] Cherrypy

2011-05-25 Thread Bryton
Is anyone having a step by step tutorial of cherrypy(or book title).I have used the tutorial in their site as well as the book (cherrypy essentials) and I would like to have a one that is a bit more step by step...Please help... -- Regards, Bryton. _

Re: [Tutor] Parsing an XML document using ElementTree

2011-05-25 Thread Stefan Behnel
Sithembewena Lloyd Dube, 25.05.2011 14:40: Thanks for all your suggestions. I read up on gzip and urllib and also learned in the process that I could use urllib2 as its the latest form of that library. Herewith my solution: I don't know how elegant it is, but it works just fine. def get_contest

Re: [Tutor] Parsing an XML document using ElementTree

2011-05-25 Thread Sithembewena Lloyd Dube
Hi Everyone, Thanks for all your suggestions. I read up on gzip and urllib and also learned in the process that I could use urllib2 as its the latest form of that library. Herewith my solution: I don't know how elegant it is, but it works just fine. def get_contests(): url = ' http://xml.ma

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-25 Thread Wayne Werner
On Tue, May 24, 2011 at 11:14 PM, Rachel-Mikel ArceJaeger < arcejae...@gmail.com> wrote: > Hello, > > I am having trouble with determining when python is passing by reference > and by value and how to fix it to do what I want: > Andre already mentioned that you shouldn't think of Python as 'pass-

Re: [Tutor] python scripting using "./"

2011-05-25 Thread Wolf Halton
An oddity of the PATH variable in Linux (or at least Ubuntu) is that there is a folder in PATH called /home/~/bin. The ~ is replaced with your profile name. If you create that folder and put the file into it, you can invoke it from anywhere in the filesystem with just its name. On Tue, May 24, 2