Re: [Tutor] Chapter 3 Projects

2013-04-09 Thread Dave Angel
On 04/09/2013 08:29 PM, ALAN GAULD wrote: Forwarded to group. Please use ReplyAll when responding to tutor posts. From: Mariel Jane Sanchez To: Alan Gauld Sent: Wednesday, 10 April 2013, 1:06 Subject: Re: [Tutor] Chapter 3 Projects Thank you so much, I fin

Re: [Tutor] Impossible Else as Exception

2013-04-10 Thread Dave Angel
On 04/10/2013 02:18 AM, Jordan wrote: Thank you all for the feedback and suggestions. I have never used an assertion, before so I will read up on the concept. One comment about assertion. Even though an optimized run will ignore the assertion itself, it can save a (small) amount of time avo

Re: [Tutor] running python from windows command prompt

2013-04-10 Thread Dave Angel
(Please don't hijack a thread with an unrelated question. You're no doing yourself any favors, as any decent thread-viewer will hide your new subject line, and group the whole thread with its original title. That can cause your query to be ignored by many of the readers.) To start a new threa

Re: [Tutor] Running python from windows command prompt

2013-04-10 Thread Dave Angel
On 04/10/2013 08:32 AM, Arijit Ukil wrote: I like to run a python program "my_python.py" from windows command prompt. This program ( a function called testing) takes input as block data (say data = [1,2,3,4] and outputs processed single data. import math def avrg(data): return sum(data)/len

Re: [Tutor] File not found error, but it is in the folder!

2013-04-10 Thread Dave Angel
On 04/10/2013 10:44 AM, Woody 544 wrote: I have a script that worked before I moved it to another folder. I cannot understand why I am getting a 'No such file or directory' error, when the file is in the folder. Any clues would be much appreciated. Thanks! MJ Here is a copy and paste of the

Re: [Tutor] Python bz2 "IOError: invalid data stream" when trying to decompress

2013-04-10 Thread Dave Angel
On 04/10/2013 08:18 PM, Rodney Lewis wrote: My question is at StackOverflow so I won't repeat it here. http://stackoverflow.com/questions/15938629/python-bz2-ioerror-invalid-data-stream-when-trying-to-decompress Thanks so much in advance for any help you can provide regarding this. http://www.

Re: [Tutor] Create Library

2013-04-14 Thread Dave Angel
On 04/08/2013 09:31 PM, Negin Nayeri wrote: Hi!Im supposed to do a Library in Python and I don't even know how to begin! Please just help me. Like what kind of attributes do you think I should have, how do I store information? The file with the books and authors I must fix, do think I should w

Re: [Tutor] (no subject)

2013-04-14 Thread Dave Angel
On 04/14/2013 08:35 PM, Soliman, Yasmin wrote: Hi everyone. I just need to know why this programs tells me End is not defined, what can I o to fix this issue? Thanks in advance. hrList=[] while True: heartrate= float(input('Enter heart rate as beats per min: ')) hrList.append(heartrat

Re: [Tutor] Hello, and a newbie question

2013-04-16 Thread Dave Angel
On 04/16/2013 11:58 AM, Andy McKenzie wrote: Hey folks. I'm just starting to pick up Python, and I'd like to avoid some of the mistakes I made in the past. To elaborate on that, my primary programming/scripting experience is PHP, with a little bit of Perl thrown in. Like so many people who wri

Re: [Tutor] oops - resending as plain text

2013-04-16 Thread Dave Angel
On 04/16/2013 01:48 PM, Jim Mooney wrote: I accidentally sent as HTML so this is a resend in case that choked the mailing prog ;') I was doing a simple training prog to figure monetary change, and wanted to avoid computer inaccuracy by using only two-decimal input and not using division or mod w

Re: [Tutor] Hello, and a newbie question

2013-04-16 Thread Dave Angel
On 04/16/2013 05:20 PM, Andy McKenzie wrote: Thanks for the advice, folks. Given that it looks like the biggest changes are unicode handling (which I'm not going to need any time soon) and the way the print function works, I decided to stick with 2.7. I'm an IT guy, though unemploye

Re: [Tutor] oops - resending as plain text

2013-04-16 Thread Dave Angel
On 04/16/2013 05:46 PM, Jim Mooney wrote: Further question. If I round the input right at the beginning, round(paid,2) does that mean I still have the original error from using .76 even before math, or does the rounding kill it? I would guess not if it's binary, You guess right. round() funct

Re: [Tutor] Hello, and a newbie question

2013-04-16 Thread Dave Angel
On 04/16/2013 05:47 PM, Andy McKenzie wrote: On Tue, Apr 16, 2013 at 5:31 PM, Dave Angel wrote: To get 3.x functionality, you'd want to use from __future__ import print_function and I do not think that works in 2.6 or older versions. It also can be awkward even in 2.7 if y

Re: [Tutor] How did this decimal error pop up?

2013-04-16 Thread Dave Angel
On 04/16/2013 06:10 PM, Hugo Arts wrote: The other option, and probably the simplest to use, is python's built in decimal module, which provides a special class that implements perfectly accurate decimal calculations. Why don't we use it for all applications, you might ask? Well, it is extre

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 03:27 PM, Danilo Chilene wrote: Dear Python Tutor, I have the code below(file.py): import sys a = 'This is A' b = 'This is B' c = 'This is C' for i in sys.argv[1]: if sys.argv[1] == 'a': print a if sys.argv[1] == 'b': print b if sys.argv[1] == 'c

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 04:49 PM, Danny Yoo wrote: Wait. If the solution that we're stopping at to use a hashtable here, that's not quite right. Nothing wrong with a dict, if a proper specification of the problem were available. Notice that in my solution, the messages were not all trivially related

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 05:15 PM, Danny Yoo wrote: Yup! Sorry about my tone for its stridency. But I just got concerned that the original poster seemed content about turning the chain of if statements into a table definition. To my mind, they're very closely related, data and control. I'm trying to pus

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-17 Thread Dave Angel
-- Forwarded message -- From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re: [Tutor] Sys.argv read parameters To: Danny Yoo Hello Danny, The part that is changing is just the sys.argv[1] The vars will have always the same content. What I don't want is to hav

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 08:12 PM, Alan Gauld wrote: On 17/04/13 20:27, Danilo Chilene wrote: import sys a = 'This is A' b = 'This is B' c = 'This is C' for i in sys.argv[1]: if sys.argv[1] == 'a': print a if sys.argv[1] == 'b': print b if sys.argv[1] == 'c': pr

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Dave Angel
On 04/18/2013 09:21 AM, Danilo Chilene wrote: On Wed, Apr 17, 2013 at 8:21 PM, Dave Angel wrote: -- Forwarded message -- From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re: [Tutor] Sys.argv read parameters To: Danny Yoo Hello Danny, The part that is

Re: [Tutor] path directory backslash ending

2013-04-18 Thread Dave Angel
On 04/18/2013 12:45 PM, Jim Mooney wrote: Minor question. I was adding the Py Script directory to the Win 7 Path, and noticed that Python33 ends with a backslash but many directories do not. Is there a difference? Should I use backslash or not preferentially, or doesn't it matter at all? It does

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Dave Angel
On 04/18/2013 01:14 PM, Danilo Chilene wrote: The following code has little to do with anything that happened before. So you should start a new thread for this new project. Below is the final code: import requests, json, sys r = requests.get('http://napmongo01.cvc.com.br:28017/_sta

Re: [Tutor] Py 3 package maturity - good links

2013-04-21 Thread Dave Angel
On 04/21/2013 12:24 PM, Jim Mooney wrote: On the other hand, from the perspective of "When will the *majority* of publicly-available libraries and packages support Python 3, then the answer is "Right now". The Python 3 Wall of Shame turned mostly green some time ago, and is now known as the Pytho

Re: [Tutor] is there an explicit eof to test in Py 3?

2013-04-21 Thread Dave Angel
On 04/21/2013 09:35 PM, Jim Mooney wrote: I'm reading a book that suggests finding EOF when the readLine == "" But wouldn't that end erroneously on blank lines, that really contain '\n', in which case more lines might follow? What 'empties' are considered equal in Python? I'm coming from ja

Re: [Tutor] Why is my list index going out of range

2013-04-22 Thread Dave Angel
On 04/22/2013 09:47 PM, Jim Mooney wrote: Okay, what am I doing wrong here? I'm generating primes from a list and getting "list index out of range," but since the for loops controls the indexes I don't see how that's happening. I thought it was the list append, but I commented that out and put in

Re: [Tutor] why does this not work

2013-04-23 Thread Dave Angel
On 04/23/2013 03:39 PM, Roelof Wobben wrote: Im trying to learn python by a course at codeacademy. Now I have this code : def shut_down(s): s = s.lower() if s == "yes": return "Shutting down..." elif s == "no" : return "Shutdown aborted!" else: retu

Re: [Tutor] trouble installing library

2013-04-24 Thread Dave Angel
On 04/24/2013 11:18 AM, Lolo Lolo wrote: Microsoft's C/C++ runtime only uses double quotes. So just change it to the following: >> python -c "import googlemaps" Thanks this solved the issue, now another issue has been thrown. Just not my day. after the 1st module error happens, they show

Re: [Tutor] totalViruses[i] /= float(numTrials),

2013-04-24 Thread Dave Angel
On 04/24/2013 10:59 AM, Sydney Shall wrote: //I am a beginner just learning Python. Welcome to the mailing list. I hope you enjoy your experience with Python. I have come across the following usage for the first time. totalViruses[i] /= float(numTrials) Does it mean? ; totalViruses[i

Re: [Tutor] Concatenating numeric data in Python 3.3

2013-04-24 Thread Dave Angel
On 04/24/2013 12:52 PM, sparkle Plenty wrote: What is the best way to concatenate packed numeric data? I am building a message to send to a device and it has a very specific header format and variable length payload. Converting to string, concatenating, and then converting back to numeric intro

Re: [Tutor] totalViruses[i] /= float(numTrials),

2013-04-24 Thread Dave Angel
On 04/24/2013 06:58 PM, Oscar Benjamin wrote: On 24 April 2013 23:41, Alan Gauld wrote: On 24/04/13 20:32, Oscar Benjamin wrote: On 24 April 2013 20:07, Alan Gauld wrote: On 24/04/13 16:52, Dave Angel wrote: Does it mean? ; totalViruses[i] = totalViruses[i]/float(numTrials) As the

Re: [Tutor] what is the meaning of variable e

2013-04-25 Thread Dave Angel
On 04/26/2013 01:45 AM, wang yong wrote: Hi tutors, I am a newb. Please bear with my simple question. If you're new to Python, then any GUI question isn't "simple." But perhaps you're not new to Python, but only to PyQT. I'll qualify my remarks with the statement that I'm not familiar with

Re: [Tutor] sha-256 without using hashlib

2013-04-26 Thread Dave Angel
On 04/26/2013 05:08 AM, Arijit Ukil wrote: I like to implement sha-256 without using implement. It is easy using hashlib as: import hashlib m = hashlib.sha256() m.update("hi") print m.hexdigest() If anybody has pointer on sha-256 implemented without using hashlib library, please share. If yo

Re: [Tutor] symlinking dirs with spaces

2013-04-26 Thread Dave Angel
On 04/26/2013 08:10 AM, mike wrote: Hi all, I wrote a cli script for syncing my music to a USB mass storage device like a phone etc. all it does is it creates a symlink in a dir to whatever folder i pass as an argument via ./addsync DIR . My problem is i'm having trouble dealing with directories

Re: [Tutor] getting TypeError: float() argument must be a string or a number

2013-04-26 Thread Dave Angel
On 04/26/2013 06:57 PM, Rajlaxmi Swain wrote: How can I fix this. I don't see any antecedents for the pronoun. Show us some code, tell us the situation, and show us the full traceback. Otherwise we'd just be paraphrasing the error message. Make sure the argument is a string, or an int,

Re: [Tutor] symlinking dirs with spaces

2013-04-27 Thread Dave Angel
On 04/27/2013 09:38 PM, Steven D'Aprano wrote: On 28/04/13 04:53, fo...@yahoo.com wrote: IIRC, os.symlink is not present in Python on Windows, right? (I'm on vacation now so I can't check this). But aren't soft links and shortcuts linux and windows terms for the same thing? No, although they

Re: [Tutor] symlinking dirs with spaces

2013-04-28 Thread Dave Angel
On 04/28/2013 08:17 PM, mike wrote: def sync_new(): durFind = raw_input("Enter the duration of time in days you want to link") durFind = int(durFind) fileExcl = "*torrent*" linkNew = ['find', '%s' % musicDir, '-maxdepth 2', '-mtime %s' % durFind, '-not', '-name', '%

Re: [Tutor] symlinking dirs with spaces

2013-04-28 Thread Dave Angel
On 04/28/2013 08:54 PM, mike wrote: On 04/28/2013 07:37 PM, Dave Angel wrote: On 04/28/2013 08:17 PM, mike wrote: def sync_new(): durFind = raw_input("Enter the duration of time in days you want to link") durFind = int(durFind) fileExcl = "*torrent

Re: [Tutor] symlinking dirs with spaces

2013-04-28 Thread Dave Angel
On 04/28/2013 08:54 PM, mike wrote: On 04/28/2013 07:37 PM, Dave Angel wrote: On 04/28/2013 08:17 PM, mike wrote: def sync_new(): durFind = raw_input("Enter the duration of time in days you want to link") durFind = int(durFind) fileExcl = "*torrent

Re: [Tutor] symlinking dirs with spaces

2013-04-28 Thread Dave Angel
On 04/28/2013 10:04 PM, mike wrote: On 04/28/2013 08:59 PM, Dave Angel wrote: On 04/28/2013 08:54 PM, mike wrote: On 04/28/2013 07:37 PM, Dave Angel wrote: On 04/28/2013 08:17 PM, mike wrote: def sync_new(): durFind = raw_input("Enter the duration of time in days you wa

Re: [Tutor] How to zoom in matplotlib without a mouse ?

2013-04-29 Thread Dave Angel
On 04/29/2013 05:07 AM, eryksun wrote: On Fri, Apr 26, 2013 at 4:50 PM, Peter Rowat wrote: To "zoom" a matplotlib graph, the matplotlib docs all say "use R mouse button". But my laptop has no mouse, only a touchpad (running OSX Mountain Lion). I've tried lots of "click plus key" combinations,

Re: [Tutor] Codeacademy Problem

2013-04-29 Thread Dave Angel
On 04/29/2013 12:31 PM, Joseph Parkton wrote: Yupp I totally agree on the errors. I finally had to change the def hotel_cost(nights): nights = nights * 140 return nights to def hotel_cost(nights): return hotel_cost(nights) * 140 for it to work. Strange errors

Re: [Tutor] Associate decimal values with an integer range

2013-04-29 Thread Dave Angel
On 04/29/2013 10:28 AM, sparkle Plenty wrote: Hi, I need some hints on where to start solving this problem. I have to interpret a one-byte floating point number as a range between 0 and 240. This is for a gui that controls an amplifier. I am getting a value such as 0.8367 from a fader control,

Re: [Tutor] Why do I not get the same results for these two functions when I pass 7 as an argument?

2013-05-03 Thread Dave Angel
On 05/03/2013 12:51 PM, Nonso Ibenegbu wrote: Great! Many thanks for the help offered. The background of the problem is that if I book a certain service for 1 or 2 days I pay $40 per day, if I book 3, 4, 5 or 6 days I get $20 off but if I book above 7 days I get $50 off. The first function does

Re: [Tutor] Using graphics

2013-05-05 Thread Dave Angel
On 05/05/2013 07:49 AM, Stafford Baines wrote: I have just finished Python Programming by Michael Dawson. A wonderful book with downloadable examples. However, after many hours of frustrating attempts I can't get the graphics to work. I get error messages such as 'no module called python.image

Re: [Tutor] Using graphics

2013-05-05 Thread Dave Angel
Please reply to the list, not to an individual, unless the response is personal, or something like a thank-you. Also, please put your response *after* whatever you're quoting, and use the feature in your mail that uses the carets to mark quoted portions. On 05/05/2013 09:17 AM, Stafford Baine

Re: [Tutor] Why do sets use 6 times as much memory as lists?

2013-05-07 Thread Dave Angel
On 05/07/2013 01:10 PM, Bjorn Madsen wrote: import sys L=[x for x in range(1)] sys.getsizeof(L) 43816 L={x for x in range(1)} sys.getsizeof(L) 262260 ? kind regards, Bjorn Just curious: what did you expect? Sets have a different purpose, basically to be able to do an 'in' operatio

Re: [Tutor] Text Editors and Linux (was Re: exit message)

2013-05-09 Thread Dave Angel
On 05/09/2013 02:47 AM, Alan Gauld wrote: On 09/05/13 05:01, Prasad, Ramit wrote: What I like about screen is the way sessions stay open when disconnected, but I find tabbed terminals easier to scroll for history. If there is a tabbed terminal that will allow split screens then all the neat fea

Re: [Tutor] MutableString/Class variables

2013-05-09 Thread Dave Angel
On 05/09/2013 08:10 AM, Albert-Jan Roskam wrote: Hello, I was just playing a bit with Python and I wanted to make a mutable string, that supports item assignment. Is the way below the way to do this? The part I am not sure about is the class variable. Maybe I should also have reimplemented __i

Re: [Tutor] MutableString/Class variables

2013-05-09 Thread Dave Angel
On 05/09/2013 09:16 AM, Albert-Jan Roskam wrote: Subject: Re: [Tutor] MutableString/Class variables On 05/09/2013 08:10 AM, Albert-Jan Roskam wrote: Hello, I was just playing a bit with Python and I wanted to make a mutable string, that supports item assignment. Is the way below the wa

Re: [Tutor] bad name in module

2013-05-10 Thread Dave Angel
On 05/10/2013 01:45 AM, Jim Mooney wrote: I have a simple program, below, to create a specified list of random integers, which works fine. I saved it to Lib as makeRandomList.py, then imported it to a sorter.py program, like so. The import doesn't fail: import makeRandomList newRandomList = cre

Re: [Tutor] range efficiency

2013-05-10 Thread Dave Angel
On 05/10/2013 05:19 PM, Jim Mooney wrote: If I'm using a variable-dependent range in a for loop, is Python smart enough to figure the variable once so I don't have to hoist it up? That is for c in range(0,x+2), is x+2 figured once or every time through the loop? I'm assuming it's once but I like

Re: [Tutor] Making a Primary Number List generator

2013-05-11 Thread Dave Angel
On 05/11/2013 04:44 PM, Daniel Magruder wrote: Dear Tutor at Python.org, I am new to the python language and have been teaching myself through various online resources. I found an exercise where I am to create a program that prints a list of the first 1000 prime numbers. After many attempts and

Re: [Tutor] Making a Primary Number List generator

2013-05-12 Thread Dave Angel
ault), but many people do object. In Thunderbird, you normally just do Reply-list, and it does the right thing. But with other email programs, you might do reply-all, and remove whichever recipients you don't need. Dear Dave, I can't tell you how much I appreciate your assistance, h

Re: [Tutor] help regarding game code

2013-05-12 Thread Dave Angel
On 05/12/2013 03:40 PM, Alex Norton wrote: im new to python and im in the middle of making a RPS game for a college unit. You sent this message 20 minutes after posting a similar one, with a DIFFERENT title, on python-list. You really ought to pick a target and pull the trigger once. Only i

Re: [Tutor] under, under

2013-05-13 Thread Dave Angel
On 05/13/2013 12:21 PM, Stafford Baines wrote: Please explain the significance of __some term__. For example __name__ as in If __name__ == '__main__': main() When is the under, under used? (Please don't start a second thread with identical content 20 minutes after the first) Undersc

Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Dave Angel
On 05/13/2013 07:01 PM, Daniel Magruder wrote: Dear Dave, I am using python 2. I am still confused as what return does. What does it mean if a > function returns True to the caller? What is the caller? Have you ever used (called) a function? If so, you've written a caller. For exa

Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Dave Angel
On 05/13/2013 07:55 PM, Alan Gauld wrote: On 14/05/13 00:01, Daniel Magruder wrote: That seems OK but it would be simpler with a for loop: def counting_primes(): primelist = [] for prime in range(2,1000): if isprime(prime): primelist.append(prime) return pr

Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Dave Angel
(Please don't top-post. And don't reply privately, as I'm not the only one reading this thread. Post the reply to the list, as you did last time with your reply-all) On 05/13/2013 09:45 PM, Daniel Magruder wrote: Dear Dave, I don't have a clue what you're co

Re: [Tutor] python beginner-doubt

2013-05-15 Thread Dave Angel
Somehow, your message didn't appear here for 9 days. That's probably why you haven't seen any responses yet. On 05/06/2013 01:26 AM, subha krishna wrote: hi, i need an help in the following program i just started to learn. if speed >= 80: print 'License and registration please' Indenta

Re: [Tutor] Interested in learning Python

2013-05-15 Thread Dave Angel
(Your message suddenly appeared here today, after four days in limbo) On 05/11/2013 08:50 AM, Raymond Jackson wrote: Hello My name is Raymond Jackson I am currently on your tutorial site Be explicit. There are lots of tutorial sites around. Perhaps you mean http://docs.python.org/tutorial

Re: [Tutor] Issue with string method: str(variable ** n)

2013-05-16 Thread Dave Angel
On 05/16/2013 02:58 PM, Rafael Knuth wrote: Hej, I wrote a tiny little program which I was hoping would take a number as input, square and print it: square = input ("Enter a number. ") print (str(square) + " squared is " + str(square ** 2)) It seems I can't work with variables within the str()

Re: [Tutor] Python Idle Crashing

2013-05-16 Thread Dave Angel
On 05/16/2013 02:17 PM, kyle seebohm wrote: I recently created a program that searches through a computer's drive to make a list of all the files in that drive. However, the drive I am attempting to parse through is extremely large and when I run my program, it runs for about 5 or 10 minutes t

Re: [Tutor] Retrieving data from a web site

2013-05-17 Thread Dave Angel
On 05/17/2013 07:57 PM, Phil wrote: I'd like to "download" eight digits from a web site where the digits are stored as individual graphics. Is this possible, using perhaps, one of the countless number of Python modules? Is this the function of a web scraper? Anything's possible. But if these

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-17 Thread Dave Angel
On 05/17/2013 08:46 PM, Steven D'Aprano wrote: On 18/05/13 05:23, Albert-Jan Roskam wrote: Hi, I was curious what the "high" four-byte ut8 unicode characters look like. What typeface are you using to print them? Most type faces ("fonts") only support a tiny portion of the Unicode range. For t

Re: [Tutor] Unsubscribe

2013-05-18 Thread Dave Angel
On 05/16/2013 12:58 PM, Stafford Baines wrote: I only intend this to be temporary. I'm going away for a couple of weeks and don't want my mailbox overflowing when I return.😃 Thanks for all the help Sent from my iPhone ___ Tutor maillist - Tutor@pyth

Re: [Tutor] model methods in Django

2013-05-18 Thread Dave Angel
On 05/18/2013 03:16 PM, Matthew Ngaha wrote: im following the official docs and after learning Python im sure of how methods work, but the model example on the beginners guide which official docs? URLs please? which beginners guide? URL please? has me really confused. I don't know Djan

Re: [Tutor] Retrieving data from a web site

2013-05-19 Thread Dave Angel
On 05/19/2013 07:30 AM, Phil wrote: On 19/05/13 18:05, Peter Otten wrote: Phil wrote: My apatite having been whetted I'm now stymied because of a Ubuntu dependency problem during the installation of urllib3. This is listed as a bug. Has anyone overcome this problem? Perhaps there's another li

Re: [Tutor] from import works but I'm flubbing a package import

2013-05-19 Thread Dave Angel
On 05/19/2013 09:30 PM, Jim Mooney wrote: Still puzzling on imports. I have the jimlib module in Lib with the proper __init__.py . Inside it is the program bark.py, with data item zarf that contains string 'fraz' It also contains the function barker. def barker(): print 'bark, bark' If I

Re: [Tutor] Which version of python should i use?

2013-05-20 Thread Dave Angel
On 05/20/2013 05:59 AM, Amal Thomas wrote: hi, I am a beginner. I am using a unix sytem (ubuntu 12.10). Python 2.7.3 is installed in my system. I found out that Python has version upto 3.3.2. Welcome, and thanks for telling us your environment up front. Should I update my python version?

Re: [Tutor] still clarifying imorting

2013-05-20 Thread Dave Angel
On 05/20/2013 09:43 PM, Jim Mooney wrote: If I make a package called jimlib with __init__.py in it, and a program called bark.py in it, and even put it in site packages, I still have to import the program with import jimlib.bark But I noticed that the pygraphics package is in site packages, an

Re: [Tutor] still nosing around

2013-05-22 Thread Dave Angel
On 22 May 2013 05:26, Jim Mooney wrote: > But that brings up a point. Does this mean that if I have to test a > module with a lot of subroutines I have to rename every subroutine > with 'test' appended? > No, you don't rename the existing functions. But the testing functions need to be ident

Re: [Tutor] try..except - what about that ton of **Error statements?

2013-05-22 Thread Dave Angel
On 05/22/2013 03:03 PM, Albert-Jan Roskam wrote: Subject: Re: [Tutor] try..except - what about that ton of **Error statements? On 23/05/13 02:09, boB Stepp wrote: I was not aware that hardware damage could be caused by poor programming. I am curious; can you give some examples of how th

Re: [Tutor] keyboard interrupt

2013-05-22 Thread Dave Angel
On 05/22/2013 04:11 PM, Jerry Hill wrote: On Wed, May 22, 2013 at 3:47 PM, Jim Mooney wrote: I made a simple ear frequency-tester, but I don't want it to go on forever, so I tried stopping it when I pressed a key, as below, but that doesn't work. I did check out keyboard interrupts but they se

Re: [Tutor] keyboard interrupt

2013-05-22 Thread Dave Angel
On 05/22/2013 09:46 PM, Jim Mooney wrote: What do you mean "doesn't do anything" ? It certainly terminates the loop, which was the intent. Provided of course that something else isn't trapping the Ctrl-C first. It doesn't in Windows proper, using Wing 101. Then Wing is changing the behavior

Re: [Tutor] Presenting text in different ways by using quotes!

2013-05-23 Thread Dave Angel
On 05/23/2013 01:31 PM, Andrew Triplett wrote: I am asked to present text in different ways by using quotes in strings. for example: print("Program "Game Over" 2.0") syntax error. If you need quotes inside quotes, you probably want to use single-quotes for one type. For example, print('P

Re: [Tutor] Difference between types

2013-05-23 Thread Dave Angel
On 05/23/2013 03:57 PM, Citizen Kant wrote: It's quite hard to believe that you're not just trolling. Little that you say below makes any sense with regards to Python. I guess I'm understanding that, in Python, if something belongs to a type, must also be a value. Nothing belongs to a ty

Re: [Tutor] making a random list, then naming it

2013-05-23 Thread Dave Angel
On 05/23/2013 10:39 PM, Jim Mooney wrote: I keep needing random lists of integers for trying things, so I wrote a small prog I'll import as randlist. The user enters the length and max val, but then I want the actual data name of the random list created, to be list_(length entered)_(max value e

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Dave Angel
On 05/24/2013 07:04 AM, Citizen Kant wrote: Are you referring to this definition? http://en.wikipedia.org/wiki/**Value_%28computer_science%29 Any chance you can fix your use of gmail to conform to the usual standards? It does it rig

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Dave Angel
On 05/24/2013 02:53 PM, Albert-Jan Roskam wrote: A tuple is defined by commas, depending on context. However, parentheses are typically required because commas have low precedence. >>> 1, 2 + 3, 4 (1, 5, 4) >>> (1, 2) + (3, 4) (1, 2, 3, 4) An empty tuple is a special cas

Re: [Tutor] making a random list, then naming it

2013-05-24 Thread Dave Angel
On 05/24/2013 08:04 PM, Jim Mooney wrote: You forgot to give the author attribution on the following paragraph. I happen to recognize my own text, but that's not a nice thing to do. Notice above where it says "Jim Mooney wrote" ? The short answer is that Python is not designed to be able t

Re: [Tutor] making a random list, then naming it

2013-05-24 Thread Dave Angel
On 05/24/2013 09:35 PM, Jim Mooney wrote: On 24 May 2013 18:10, Dave Angel wrote: Is lists[(3,8)] really so much harder to type than list_3_8 ? You have a point. I hate underlines - my finger always misses them. Keyboards were not designed for programming ;') Anyway, I just th

Re: [Tutor] Fwd: Difference between types

2013-05-25 Thread Dave Angel
On 05/25/2013 08:54 AM, Albert-Jan Roskam wrote: From: Dave Angel The empty tuple is specified with (). But for any tuple with one or more members, it's the commas that turn it into a tuple. The parens are not necessarily needed unless the statement is complex enough that we

Re: [Tutor] why can you swap an immutable tuple?

2013-05-25 Thread Dave Angel
On 05/25/2013 02:56 PM, Jim Mooney wrote: I thought tuples were immutable but it seems you can swap them, so I'm confused: The anonymous tuple object is immutable, but you just build one temporarily, extract both items from it, and destroy it. a,b = 5,8 The a,b on the left hand side is

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread Dave Angel
On 05/27/2013 07:56 PM, ALAN GAULD wrote: I can't speak for Jim, but I have used the dis module in the past to quickly check how python parsed an expression (e.g. not x is y). Yes, I've done that too. But that's not the bytecodes (at least not what I understand as bytecodes) that's the dis-asse

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-28 Thread Dave Angel
On 05/28/2013 07:02 AM, Jim Mooney wrote: On 27 May 2013 16:20, Alan Gauld wrote: To me, the bytecodes are the literal hex values corresponding to the Python "assembler" statements. Are you sure you need the bytecodes? You can use the standard library to generate the assembler listing from th

Re: [Tutor] Python "well-formed formulas"

2013-05-28 Thread Dave Angel
On 05/28/2013 08:20 AM, Walter Prins wrote: Hi, On 28 May 2013 12:44, Citizen Kant wrote: Could you please help me with a simple example of a Python well-formed formula in order to understand "well-formed formulas" and "formation rules" concepts properly? I'm assuming you perhaps meant "we

Re: [Tutor] Python "well-formed formulas"

2013-05-28 Thread Dave Angel
On 05/28/2013 09:45 AM, Citizen Kant wrote: I'm trying to figure out the rules on how to recognize when a combination of symbols is considered a well formed expression in Python. Since I couldn't find any doc that lists all Python syntax rules --or maybe the doc is too long to be managed b

Re: [Tutor] Socket Error Handling Syntax

2013-05-28 Thread Dave Angel
On 05/28/2013 03:37 PM, sparkle Plenty wrote: If I use an if statement, I cannot use continue after I do my error handling, The presence of an if statement cannot affect whether or not a continue can work. If you give a concrete code example, somebody will be able to identify the confusion.

Re: [Tutor] walk registry using _winreg

2013-05-29 Thread Dave Angel
On 05/29/2013 04:11 AM, Albert-Jan Roskam wrote: Hello, I created a program to go through the windows registry and look for a certain key ("file_locations", though in the example I am using a key that every windows user has on his/her computer). If found, I want to replace the data associated

Re: [Tutor] Project Euler #8

2013-05-31 Thread Dave Angel
On 05/31/2013 02:23 PM, Nick Shemonsky wrote: Hey there everybody. I'm new to python Welcome. But are you new to programming, or just to Python in particular? And which Python? I'd guess 2.7 and am attempting to teach myself to code while brushing up on my math skills via the problems at

Re: [Tutor] Project Euler #8

2013-05-31 Thread Dave Angel
On 05/31/2013 04:49 PM, Nick Shemonsky wrote: Here's the final code... I kept the if statement that way if I throw in a random series of numbers that isn't evenly divisible by 5, it'll always work itself out. And this answered the 1000 digit problem without issue. str_num = '1234567890' n =

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread Dave Angel
On 06/01/2013 11:58 PM, Jim Mooney wrote: It's a little unclear to me where generators are more efficient. I'm astounded nobody has asked you what version of Python this is for. in Python 2.x, the range(x,y) function produces the whole list, and then the expression around it converts that to

Re: [Tutor] First program after PyCamp

2013-06-10 Thread Dave Angel
On 06/10/2013 04:03 PM, bja...@jamesgang.dyndns.org wrote: Hello I just took a 3 day PyCamp and am working on my first program from start to finish at the moment and running into a problem. Not sure how it's supposed to be on this list Please start by defining your version of Python. I'm goin

Re: [Tutor] Value Error

2013-06-12 Thread Dave Angel
On 06/12/2013 04:49 PM, Jim Mooney wrote: I'm going through the exceptions so I can recall and use the basic ones (not much use for unicode errors at this point ;') But I'm puzzled by an aspect of the Value Error: *exception *ValueError Raised when a built-in operation or function receives an a

Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-12 Thread Dave Angel
On 06/12/2013 05:32 PM, Matt D wrote: On 06/10/2013 12:23 PM, Prasad, Ramit wrote: Matt D wrote: Ramit Prasad wrote: Scrolled panel is just a graphical container that allows for scrolling inside, but it is the window that scrolls not widgets inside it. This of it like a webpage that scrolls. I

Re: [Tutor] Value Error

2013-06-12 Thread Dave Angel
On 06/12/2013 06:07 PM, Jim Mooney wrote: On 12 June 2013 14:16, Steve Willoughby wrote: or if you try to take the square root of a negative number, etc. Or the log of -10. Although sqrt(-1) works fine for cmath.sqrt(-1) - I think I get it. Come to think of it you can do cmath.log(-10), bu

Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-12 Thread Dave Angel
On 06/12/2013 08:46 PM, Matt D wrote: On 06/12/2013 05:59 PM, Dave Angel wrote: On 06/12/2013 05:32 PM, Matt D wrote: Hey, if i put: self.logfile = open('logfile.csv', 'w') in the .py file, within the 'class TrafficPane', then shouldn't logfile.

Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-12 Thread Dave Angel
On 06/12/2013 09:23 PM, Matt D wrote: There are other ways a script might change the current directory. For example, some naive scripts use os.chdir() But how is it you don't know what the current directory was when the code ran? A simply pwd can tell you, if your prompt doesn't already rev

Re: [Tutor] Value Error

2013-06-13 Thread Dave Angel
On 06/13/2013 04:09 AM, eryksun wrote: On Wed, Jun 12, 2013 at 6:31 PM, Dave Angel wrote: i = complex(0,1) >>> 1j 1j I had forgotten that notation for a complex literal. I knew the magic syntax had j in it, but didn't remember it needs to be part of the nume

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-13 Thread Dave Angel
On 06/13/2013 12:18 AM, Matt D wrote: yes the .py file has TextCtrl fields that get there values from a pickled dictionary. Another peice of the code watches a thread for the pickle. this is why i didnt use a list. I have been unable to find a nice way to just make a list with the it

<    11   12   13   14   15   16   17   18   19   20   >