Re: [Tutor] OT: Drag and Drop GUI IDE ideas

2011-07-28 Thread Adam Bark
Rance Hall gmail.com> writes: > We want the students to develop a small app in the process, It could > be a firefox extension, mobile phone app, or any other type simple > structure. > > The catch is that the class is for non-programmers to try to get them > introduced to the field. We would lik

Re: [Tutor] serial device emulator

2011-07-05 Thread Adam Bark
What Chris is getting at is that you'll use some module, eg pyserial, to interface with the serial port. So if you write a little module that has the same interface then you can pretend you have a serial port attached device and then switch over to an actual one without changing anything else i

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] after(), how do I use it?

2011-04-25 Thread Adam Bark
On 26/04/11 01:36, michael scott wrote: Hello, I asked for help in another location and it solved my problem, but the only problem is I don't fully understand the after function. Here is part of the code that was given to me. def print_label_slowly(self, message): '''Print a label

Re: [Tutor] lambda

2011-03-19 Thread Adam Bark
On 19/03/11 14:44, Ajit Deshpande wrote: I am trying to figure out where lambda functions can be useful. Has anyone used them in real world? From my reading so far, I hear people claim that lambda can be a useful replacement for small functions. Most examples didn't make much sense to me. Wh

Re: [Tutor] multiple if and or statement

2011-03-14 Thread Adam Bark
On 14/03/11 19:41, Mike Franon wrote: HI, I had a question, when running this small snippet of test code: a = ['test1', 'flag', 'monday'] for i in a: if i == 'test1' or 'test2': print 'true' It always prints true $ ./testing.py true true true I know I am missing something,

Re: [Tutor] Concatenating string

2011-02-22 Thread Adam Bark
On 22/02/11 13:46, tee chwee liong wrote: hi, >>> bin(0xff0) '' >>> bin(0xff1) '0001' >>> a=bin(0xff0)+bin(0xff1) >>> a '0001' >>> b=0xff0 >>> c=0xff1 >>> d=b+c >>> d 8161 >>> bin(d) '1' question: 1) why is it that a and d values are different

Re: [Tutor] question regarding regular expression compile

2011-01-12 Thread Adam Bark
On 12/01/11 13:19, Yaniga, Frank wrote: I am determining a regular expression that can recognize the any of the following strings: MAT file log\20101225 deleted MAT file billing\20101225 deleted MAT file util\20101225 deleted MAT file carrier\20101225 deleted I begin by creating a regular expres

Re: [Tutor] 'or' in assignment (not if statement)?

2010-12-09 Thread Adam Bark
On 10/12/10 00:51, Alex Hall wrote: Hi all, I am reading the source of a project I hope to help with (http://www.qwitter-client.net). I sometimes see something like: val=val or 1 I am guessing that val is an int. If val==0, the 'or' kicks in and val=1, else the or is not needed and val=val. Am I

Re: [Tutor] calling a method within a function

2010-12-07 Thread Adam Bark
On 07/12/10 22:36, John wrote: Hello, I have a strange problem with a piece of code I've written. It's a bit overly complicated to make an example with, but the gist is below. But in the example below, it works. However, in my example, when I call the method from within the function, it returns

Re: [Tutor] role playing game - help needed

2010-12-07 Thread Adam Bark
On 07/12/10 22:10, Al Stern wrote: Tried to use the documentation but still getting the errors... The 1st one has to do with the available_points # set variables attributes = {"strength": 0, "health": 0, "wisdom": 0, "dexterity": 0} MAX_POINTS = 30 available_points = MAX_POINTS - attributes.value

Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread Adam Bark
On 01/12/10 01:00, John Smith wrote: Hi, Walter - I got pywin32-214.win32-py2.7.exe because I have the Intel i7 (I'm guessing that the AMD versions are for the AMD processor). However, all of the exe offerings have the same "Python not found in registry" problem that started this whole thing

Re: [Tutor] Random Number Question

2010-11-24 Thread Adam Bark
On 24/11/10 22:10, Jeff Goodwin wrote: Ok, I found the problem, I had saved the file as random.py looks like that was a no-no. Its working now that I changed the name. Thanks! Jeff Ah yes always avoid giving your modules names that appear in the standard library. It goes wrong, sometimes in un

Re: [Tutor] Random Number Question

2010-11-24 Thread Adam Bark
On 24/11/10 21:51, Jeff Goodwin wrote: Hello, I'm trying to find a way to use the random.randint function to generate a random number, but everytime I run the program it locks up IDLE. Here is what I have so far: import random def main(): x = input("Enter a number: ") y = input("Ente

Re: [Tutor] Assistance with Psuedocode

2010-11-17 Thread Adam Bark
On 18/11/10 00:49, Alan Gauld wrote: "Joe Ohmer" wrote The following code works well but I don't understand why the mysteryEffect code block changes the picture. Doesn’t 64*(r/64) just equal r? That dependfs on which version of Python you use. In earlier versions '/' meant integer division

Re: [Tutor] Accessing columns of a CSV file

2010-11-17 Thread Adam Bark
On 17/11/10 13:59, Hanlie Pretorius wrote: Hi, I'm reading a CSV file and I want to test the contents of its second column before I write it to an output file: import csv time_list=['00:00', '03:00', '06:00','09:00','12:00','15:00','18:00','21:00'] readfile='C8R004_flow.csv' in_text=open(r

Re: [Tutor] While Loops: Coin Flip Game

2010-11-14 Thread Adam Bark
On 14/11/10 22:16, Dawn Samson wrote: Greetings, I'm a Python beginner and working my way through Michael Dawson's Python Programming for the Absolute Beginner. I'm stuck in a particular challenge that asks me to write a program that "flips a coin 100 times and then tells you the number of he

Re: [Tutor] if statement

2010-11-02 Thread Adam Bark
On 02/11/10 19:36, christopher.h...@allisontransmission.com wrote: Glen Clark wrote on 11/02/2010 03:07:18 PM: in general you should use raw_input instead of input. > confirmed = int(input("Are you happy with this? (y/n): ") > It would appear that Glen is using python 3.x as he used the pri

Re: [Tutor] if statement

2010-11-02 Thread Adam Bark
On 02/11/10 19:07, Glen Clark wrote: sorry: NumItems = int(input("How many Items: ")) Entries = [] for In in range(0,NumItems): Entries.append("") for In in range(0,NumItems): Entries[In]=str(input("Enter name " + str(In+1) + ": ")) for In in range(0,NumItems): print(E

Re: [Tutor] if statement

2010-11-02 Thread Adam Bark
On 02/11/10 19:02, Glen Clark wrote: File "/home/glen/workspace/test.py", line 19 if confirmed == "y": ^ SyntaxError: invalid syntax Why does this not work??? PyDev says "Expected:else" It's hard to tell without context. Can you send the code around it as well

Re: [Tutor] Summing up numbers in a file

2010-10-26 Thread Adam Bark
On 26/10/10 21:20, masawudu bature wrote: How do I sum all occurrences of a number in a file? I have a file with a bunch of numbers, each on it's own line: 5 3 11 3 7 3 5 5 11 7 7 ... How do i sum them up so that the output will be , 5 : 15 3 : 9 11: 22 7 : 21 Assuming you know how to ite

Re: [Tutor] What is random.triangular() used for

2010-10-24 Thread Adam Bark
On 24/10/10 21:57, Richard D. Moores wrote: On Sun, Oct 24, 2010 at 13:29, Emile van Sebille wrote: From people who would know found at http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.triangular.html """The triangular distribution is often used in ill-defined problems w

Re: [Tutor] searching for newlines does not work!

2010-10-23 Thread Adam Bark
On 23/10/10 23:03, win...@interchange.ubc.ca wrote: This is driving me batty! In the interactive window, I can use string.replace on newlines for some strings and not for others. Here is what work for newlines: b...@bill-laptop:~$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC

Re: [Tutor] What does "TypeError: 'int' object is not iterable"mean?

2010-10-23 Thread Adam Bark
On 23/10/10 13:38, Alan Gauld wrote: "Steven D'Aprano" wrote It would have to be a *very* old version. The use of * as the width parameter in format strings goes back to the Dark Ages of Python 1.5: ... I believe this is a virtual copy of string formatting from C, in which case it probably go

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread Adam Bark
On 14/10/10 20:33, David Hutto wrote: On Thu, Oct 14, 2010 at 3:31 PM, David Hutto wrote: On Thu, Oct 14, 2010 at 3:24 PM, Adam Bark wrote: On 14/10/10 20:21, David Hutto wrote: On Thu, Oct 14, 2010 at 2:58 PM, Adam Barkwrote: Actually, I needed

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread Adam Bark
On 14/10/10 20:21, David Hutto wrote: On Thu, Oct 14, 2010 at 2:58 PM, Adam Bark wrote: Actually, I needed it to be converted to something without a string attached to it. See a post above, and it was fixed by eval(), Thanks though. And I'm sure at some point this morning in a mome

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread Adam Bark
On 14/10/10 19:29, David Hutto wrote: On Thu, Oct 14, 2010 at 2:19 PM, Sander Sweers wrote: On 14 October 2010 16:14, David Hutto wrote: (u'graph1', u'Line', u'222', u'BLUE', u'1,2,3,4', u'True', u'0,5,0,10') Which is a tuple of unicode strings. From this I need to place portions o

Re: [Tutor] pickle problem

2010-10-12 Thread Adam Bark
On 12/10/10 18:35, Roelof Wobben wrote: Hello, I have this code : import urllib import pickle image = urllib.URLopener() image.retrieve("http://www.pythonchallenge.com/pc/def/peak.html","banner.p"; ) plaatje = open("banner.p", "rb") plaatje2 = pickle.load(plaatje) But it gives this output :

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Adam Bark
On 11/10/10 23:52, Steven D'Aprano wrote: On Tue, 12 Oct 2010 01:55:10 am Adam Bark wrote: On 11/10/10 15:29, Denis Gomes wrote: Thank you both for your responses. I do have one other question if I use the method both of you describe. How do I go about implementing slicin

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Adam Bark
On 11/10/10 15:29, Denis Gomes wrote: Thank you both for your responses. I do have one other question if I use the method both of you describe. How do I go about implementing slicing and indexing for an object in python? A list object innately has them and that is really why I wanted to use i

Re: [Tutor] selecting elements from dictionary

2010-09-15 Thread Adam Bark
On 15/09/10 15:31, Hs Hs wrote: Dear Steven, Thanks for your help. however I have a question, using: for key, value in xdic.items(): if 1 in value and 2 in value or 3 in value: print key also print keys that have values such as [1,2,3]. In cases where there is [1,2,3] and [1,2]

Re: [Tutor] How to numerically sort strings that start with numbers?

2010-09-13 Thread Adam Bark
27;21 trewuuioi', '3zxc', '134445'] >>> theList = sorted(theList) >>> theList ['134445', '21 trewuuioi', '3zxc'] >>> theList[::-1] ['3zxc', '21 trewuuioi', '134445'] >>> theList.

Re: [Tutor] How to numerically sort strings that start with numbers?

2010-09-13 Thread Adam Bark
On 14/09/10 01:11, Pete O'Connell wrote: theList = ["21 trewuuioi","3zxc","134445"] print sorted(theList) Hi, the result of the sorted list above doesn't print in the order I want. Is there a straight forward way of getting python to print ['3zxc','21 trewuuioi','134445'] rather than ['134445',

Re: [Tutor] What's the best way to ask forgiveness here?

2010-09-13 Thread Adam Bark
On 13/09/10 20:12, Brian Jones wrote: Thanks for the replies so far. One thing that's probably relevant: once a directory is created, I can expect to write a couple of hundred files to it, so doing a 'try os.makedirs' right off the bat strikes me as coding for the *least* common case instead of

Re: [Tutor] What's the best way to ask forgiveness here?

2010-09-13 Thread Adam Bark
On 13/09/10 19:31, Brian Jones wrote: I've been coding Python long enough that 'asking forgiveness instead of permission' is my first instinct, but the resulting code is sometimes clumsy, and I wonder if someone can suggest something I'm missing, or at least validate what's going on here in som

Re: [Tutor] Serial communication ...

2010-09-13 Thread Adam Bark
On 13/09/10 16:36, Markus Hubig wrote: Hi @all! I'm about to write a class for serial communication on Win32 and Linux which provides a method called "talk" to send something over the serial line, wait for the answer and returns it. My problem is, that I don't know how long the answer will b

Re: [Tutor] Lost in the control flow

2010-08-13 Thread Adam Bark
On 11/08/10 18:14, Eduardo Vieira wrote: On Tue, Aug 10, 2010 at 1:56 PM, Adam Bark wrote: The problem is you don't call make_dict unless there's a "FUEL SURCHARGE" or multiple pins. Also you don't add the first pin to mydict["tracking"] unless the

Re: [Tutor] elif statement

2010-08-10 Thread Adam Bark
On 11/08/10 02:34, Sudarshana Banerjee wrote: Hi: I am trying to teach myself Python, and am stuck at the indentation with the elif statement. This is what I am trying to type (as copied from the textbook): x=3 if x==0: print "x is 0" elif x&1 ==1: print "x is a odd number" elif x&1==0

Re: [Tutor] Lost in the control flow

2010-08-10 Thread Adam Bark
On 10/08/10 20:39, Eduardo Vieira wrote: Hello, list! I'm trying to parse a text file. I'm getting confuse with my strategy, and flags or how to use a sequence of ifs or elifs, continue, etc. Anyhow, after several experiments this is close to what I'd like to get, except, I can't find a way to in

Re: [Tutor] "x and y" means "if x is false, then x, else y"??

2010-07-22 Thread Adam Bark
On 6 July 2010 02:05, Lie Ryan wrote: > On 07/05/10 22:23, Adam Bark wrote: > > > > > I should add that this is how something like: > > > > if x != y: > > do_something() > > > > works, if expects a True or False (this isn't always true bu

Re: [Tutor] Path?

2010-07-15 Thread Adam Bark
On 15 July 2010 17:21, Jim Byrnes wrote: > Adam Bark wrote: > >> On 14 July 2010 17:41, Jim Byrnes wrote: >> >> Adam Bark wrote: >>> >>> On 14 July 2010 02:53, Jim Byrnes wrote: >>>> >>>> Adam Bark wrote: >>>>

Re: [Tutor] Path?

2010-07-14 Thread Adam Bark
On 14 July 2010 17:41, Jim Byrnes wrote: > Adam Bark wrote: > >> On 14 July 2010 02:53, Jim Byrnes wrote: >> >> Adam Bark wrote: >>> >>> >>> >>> >>> If I use the terminal to start the program it has no problem using the &

Re: [Tutor] Path?

2010-07-14 Thread Adam Bark
On 14 July 2010 02:53, Jim Byrnes wrote: > Adam Bark wrote: > > > > > If I use the terminal to start the program it has no problem using the >>>>> file. There are multiple files in multiple directories so I was >>>>> looking >>>>&

Re: [Tutor] Path?

2010-07-13 Thread Adam Bark
On 13 July 2010 23:27, Jim Byrnes wrote: > Adam Bark wrote: > >> On 13 July 2010 14:43, Jim Byrnes wrote: >> >> Steven D'Aprano wrote: >>> >>> My apologizes to Steven and the list, when I replied originally I messed >>> up >

Re: [Tutor] Path?

2010-07-13 Thread Adam Bark
On 13 July 2010 14:43, Jim Byrnes wrote: > Steven D'Aprano wrote: > > My apologizes to Steven and the list, when I replied originally I messed up > and sent it to him privately which was not my intention. > > > > > On Mon, 12 Jul 2010 03:42:28 am Jim Byrnes wrote: > >> I am running Ubuntu. I dow

Re: [Tutor] Python Documentation Clarification

2010-07-12 Thread Adam Bark
On 12 July 2010 15:49, Huy Ton That wrote: > This is going to sound silly, but I realized there are some areas within > the documentation that do not make absolute sense to me. > > e.g. > > compile(source, filename, mode[, flags[, dont_inherit]]) > > I see within this built in function, the first

Re: [Tutor] Path?

2010-07-11 Thread Adam Bark
On 11/07/10 18:42, Jim Byrnes wrote: I am running Ubuntu. I downloaded the source code examples for a book I purchased. Some of the examples load image files located in the same directory as the program. If I go to the current directory in the terminal the program can use the image files. H

Re: [Tutor] Function returns 'None'

2010-07-11 Thread Adam Bark
On 11/07/10 14:59, Dominik Danter wrote: Hello As en exercise I wrote the following function: def recursfac(x,carryover=1): print 'x:',x,'carryover:', carryover if x > 1: carryover *= x recursfac(x-1, carryover) else: return carryover print recursfac(3) Ve

Re: [Tutor] newbie to gui programming

2010-07-06 Thread Adam Bark
On 6 July 2010 18:09, Payal wrote: > Hi all, > Some background before the actual query. > A friend of mine, an electronics engineer has a > small co. He had a computer engg. with him who used to design GUI > front-ends > for his products in Visual Basic. These apps used to take data from > serial

Re: [Tutor] "x and y" means "if x is false, then x, else y"??

2010-07-05 Thread Adam Bark
On 5 July 2010 13:21, Adam Bark wrote: > On 5 July 2010 12:53, Richard D. Moores wrote: > >> On Mon, Jul 5, 2010 at 04:09, Stefan Behnel wrote: >> > Richard D. Moores, 05.07.2010 11:37: >> >> >> >> I keep getting hung up over the meaning of "

Re: [Tutor] "x and y" means "if x is false, then x, else y"??

2010-07-05 Thread Adam Bark
On 5 July 2010 12:53, Richard D. Moores wrote: > On Mon, Jul 5, 2010 at 04:09, Stefan Behnel wrote: > > Richard D. Moores, 05.07.2010 11:37: > >> > >> I keep getting hung up over the meaning of "the return > >> value" of an expression. I am of course familiar with values returned > >> by a funct

Re: [Tutor] What is super for?

2010-06-28 Thread Adam Bark
On 28 June 2010 17:15, Adam Bark wrote: > I can't figure out how super(C, self).__init__() is any better than > C.__init__(self), is there a preference? Does super do something special? > > Thanks. > Whoops I should really think about these things for a minute first, you do

[Tutor] What is super for?

2010-06-28 Thread Adam Bark
I can't figure out how super(C, self).__init__() is any better than C.__init__(self), is there a preference? Does super do something special? Thanks. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.pytho

Re: [Tutor] capturing error msg in exception

2010-06-28 Thread Adam Bark
On 28 June 2010 00:27, Steven D'Aprano wrote: > On Mon, 28 Jun 2010 03:12:39 am Adam Bark wrote: > > > I think the 'as' syntax is only available in Python 3.x > > You think wrong. It is available from Python 2.6 onwards. > I know, I corrected myself a

Re: [Tutor] capturing error msg in exception

2010-06-27 Thread Adam Bark
On 27 June 2010 18:22, Steve Willoughby wrote: > On 27-Jun-10 10:12, Adam Bark wrote: > >> On 27 June 2010 17:47, Payal > > > c. What is the correct Python of writing, >>except as e: print 'Msg : ' , e# Capturing all exceptions >> >

Re: [Tutor] capturing error msg in exception

2010-06-27 Thread Adam Bark
On 27 June 2010 17:47, Payal wrote: > Hi, > Again a few queries regarding exceptions, > > a. What is the difference between, > > except ZeroDivisionError as e: print 'Msg : ' , e > except ZeroDivisionError ,e: print 'Msg : ' , e > > Both show, > Msg : integer division or modulo by zero > > b. Wh

Re: [Tutor] Repeat function until...

2010-06-23 Thread Adam Bark
On 23 June 2010 13:29, Nethirlon . wrote: > Hello everyone, > > I'm new at programming with python and have a question about how I can > solve my problem the correct way. Please forgive my grammar, English > is not my primary language. > > I'm looking for a way to repeat my function every 30 seco

Re: [Tutor] New to this

2010-06-20 Thread Adam Bark
On 20 June 2010 19:38, Neil Thorman wrote: > I'm picking this up as a hobby really, not having done any programming > since Acorn I'm pretty much starting form scratch (and even back in the > BASIC day I never really got to grips with files). > This is from Alan Gauld's Learning to Program: Handl

Re: [Tutor] Converting audio samples from 16-bit signed int to float?

2010-06-20 Thread Adam Bark
On 20 June 2010 23:52, Joe Veldhuis wrote: > Hello all. I'm writing a program that needs to capture audio from a > soundcard and run FFTs to determine peak frequency for further processing. > The soundcard's native capture format is 16-bit little-endian signed integer > samples (values 0-65535),

[Tutor] Strange range and round behaviour

2010-06-07 Thread Adam Bark
Just out of curiosity does anyone know why you get a deprecation warning if you pass a float to range but if you use round, which returns a float, there is no warning? Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "lice

Re: [Tutor] Unable to run a simple Hello.py in WinXP

2010-05-17 Thread Adam Bark
On 18 May 2010 01:30, Sivapathasuntha Aruliah < sivapathasuntha.arul...@amkor.com> wrote: > > > > > > *Adam Bark * > > > *05/18/2010 01:21 AM* > To > Sivapathasuntha Aruliah/S1/a...@amkor > cc > tutor@python.org > Subject > R

Re: [Tutor] Unable to run a simple Hello.py in WinXP

2010-05-17 Thread Adam Bark
On 17 May 2010 09:05, Sivapathasuntha Aruliah < sivapathasuntha.arul...@amkor.com> wrote: > > Hi > If possible please run the following two lines after *saving it as a py > file on WINXP* and check whether it runs smooythly. *When I run I get > error. *I use Python 3.1.2 (r312:79149, Mar 21 2010,

Re: [Tutor] reading binary file on windows and linux

2010-05-09 Thread Adam Bark
On 9 May 2010 18:33, Jan Jansen wrote: > Hello, > > I've got some trouble reading binary files with struct.unpack on windows. > According to the documentation of the binary file's content, at the > beginning there're some simple bytes (labeled as 'UChar: 8-bit unsigned > byte'). Within those byte

Re: [Tutor] Is wxPython (development) dead?

2010-01-28 Thread Adam Bark
On 27 January 2010 13:57, Neven Goršić wrote: > Since May of 2009 there has not been any update and now web page is not > available any more ... > The website is back up now. I guess there was a server issue of some sort. ___ Tutor maillist - Tutor@py

Re: [Tutor] smtp project

2010-01-18 Thread Adam Bark
2010/1/17 Kirk Z Bailey > I am writing a script that will send an email message. This will run in a > windows XP box. The box does not have a smtp server, so the script must > crete not merely a smtp client to talk to a MTA, it must BE one for the > duration of sending the message- then shut off,

[Tutor] for loop issue

2009-10-09 Thread Adam Bark
2009/10/9 Stefan Lesicnik Hi, > > This feels like a strange issue, so i hope I formulate this so its > understandable. > > I have some objects. Each object has associated values. I am looping > through these objects, working with a value and printing out the > value. > The issue in this case is t

Re: [Tutor] Memory usage (Lizhi Yang)

2009-10-08 Thread Adam Bark
or SWIG is better? Have not tried yet, > just need to make decision first, thanks. > > On Thu, Oct 8, 2009 at 9:19 AM, Lizhi Yang wrote: > > Hi Adam, > > > > Thank you so much for your help. I will do a test, and will let you > > know the result. > > > > O

Re: [Tutor] power of 2.718282

2009-01-13 Thread Adam Bark
According to a quick interactive session and the timeit module it's quicker to do 2.71828**10 than using math.exp, I'm guessing cos of the function call. >>> t=timeit.Timer("2.718282**10") >>> t.repeat() [0.073765993118286133, 0.066617012023925781, 0.06807398796081543] >>> t=timeit.Timer("math.exp

Re: [Tutor] A question about how python handles numbers larger than it's 32 bit limit

2008-09-23 Thread Adam Bark
2008/9/23 John Toliver <[EMAIL PROTECTED]> > Greetings, > > The book I have says when you anticipate that you will be working with > numbers larger than what python can handle, you place an "L" after the > number to signal python to treat it as a large number. Does this > "treating" of the number

Re: [Tutor] Interactive physics simulation over web

2008-04-04 Thread Adam Bark
On 04/04/2008, Brain Stormer <[EMAIL PROTECTED]> wrote: > > I am working on a physics simulation and would like to publish it on the > web. The simulation requires input fields, mouse action (picking points in > a display pane) and movie like feature with play, pause, skip forward and > skip backw

Re: [Tutor] Required method to make foo(*Vector(0,0,0)) work.

2007-12-18 Thread Adam Bark
On 19/12/2007, John Fouhy <[EMAIL PROTECTED]> wrote: > > On 19/12/2007, Adam Bark <[EMAIL PROTECTED]> wrote: > > I want to be able to get the values for my vector class but I don't know > > what method you need to get the * thing to work ie how to make it a >

[Tutor] Required method to make foo(*Vector(0,0,0)) work.

2007-12-18 Thread Adam Bark
I want to be able to get the values for my vector class but I don't know what method you need to get the * thing to work ie how to make it a sequence i think. Anybody know how to do this? Thanks in advance. ___ Tutor maillist - Tutor@python.org http://m

[Tutor] Top Programming Languages of 2013

2007-10-07 Thread Adam Bark
On 07/10/2007, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > > Alan Gauld wrote: > > "Dick Moores" <[EMAIL PROTECTED]> wrote > > > >> > >> > > > > Interesting, but I'm not sure what the criteria for "top" is. > > Is it a measure of power, popularity, usa

Re: [Tutor] evaluating AND

2007-09-13 Thread Adam Bark
On 13/09/2007, Terry Carroll <[EMAIL PROTECTED]> wrote: > > On Thu, 13 Sep 2007, Orest Kozyar wrote: > > > Given a variable x that can either be None or a tuple of two floats [i.e > . > > (0.32, 4.2)], which syntax is considered most appropriate under Python > > coding standards? > > > > if x and x

Re: [Tutor] Losing theexpressiveness ofC'sfor-statement?/RESENDwith example

2007-08-10 Thread Adam Bark
On 10/08/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > full-fledged lambdas... > > I'm with you there but I've been waiting long enough to have > given up. In fact I think we are more likely to lose lambdas > altogether than see an improved version! Guido said he's keeping lambdas in Python 3000

Re: [Tutor] Roman to digital (pseudocode)

2007-03-08 Thread Adam Bark
On 08/03/07, Alan Gilfoy <[EMAIL PROTECTED]> wrote: This, I heard, is more difficult than digital-to-Roman, since you have to "read" the subtractive cases, with a smaller numeral placed before a larger numeral, without simply adding all the numerals' values up I'm going to use a raw_input promp

Re: [Tutor] Send binary/hex data to a TCP socket

2007-01-24 Thread Adam Bark
On 25/01/07, Tod Haren <[EMAIL PROTECTED]> wrote: I need to send a server at the other end of a socket a 36 byte "frame", where each byte represents a specific field in the custom data structure.(If there are any Ham operators reading this, I'm talking about the AGW Packet Engine) The docum

Re: [Tutor] Psyco Puzzle

2007-01-12 Thread Adam Bark
On 11/01/07, Danny Yoo <[EMAIL PROTECTED]> wrote: > Sometimes psyco speeds up a script by a factor of 10, and sometimes > it makes no difference at all. Here's a case where I fully expected > it to make a difference: > . Whether using psyco > or n

Re: [Tutor] python dictionaries

2007-01-05 Thread Adam Bark
On 05/01/07, Raven Of Night Raven Of Night <[EMAIL PROTECTED]> wrote: Hi, there was this two step program I was working on but i can only complete the first step. - - Write a Who's Your Daddy? program that lets the user enter the name of the male and produces the name of his father. Allow the u

Re: [Tutor] Game server login encryption

2006-12-25 Thread Adam Bark
Thanks a lot Bob that looks like a plan. Carlos I think the major problem with the SSL sockets is the lack of certificate checking which, I suspect, make it vulnerable to several exploits. Thanks anyway. Adam. ___ Tutor maillist - Tutor@python.org http

Re: [Tutor] Infinite Loops (and threads)

2006-12-24 Thread Adam Bark
On 24/12/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Kent Johnson wrote: > Jonathan McManus wrote: > >> Hi all, >> >> Just a quick question, really. Is there any good way to have an infinite >> loop in a program, without said infinite loop eating up the CPU? I've >> tried the trick of addin

[Tutor] Game server login encryption

2006-12-24 Thread Adam Bark
I'm currently writing a networked game and I'm about to write a proper implementation of the logon server. I would prefer to have some sort of encryption but would like some opinions. The way I see it either I can take a hash of some data eg. username, password, port and ip and check the hash agai

Re: [Tutor] Question about exception handling

2006-12-17 Thread Adam Bark
On 17/12/06, Asrarahmed Kadri <[EMAIL PROTECTED]> wrote: Hi Folks, Is it possible to catch exception raised in module A to be caught in module B. If yes, then please let me know how to do it. You can easily test this yourself. First right a quick module, something like this will do: def e

Re: [Tutor] cylinder texture map?

2006-10-12 Thread Adam Bark
On 12/10/06, Danny Yoo <[EMAIL PROTECTED]> wrote: On Thu, 12 Oct 2006, Michael Shulman wrote:> I'd like to make a scrolling background for a game I'm working on.  I> was thinking, since it's all in orthographic view, that a horizontal> cylinder which rotates with a texture would simulate this very

Re: [Tutor] Run a cmd program

2005-08-09 Thread Adam Bark
>>> import commands >>> commands.getoutput("uptime AUTO-SRV-001 /s /d:04/01/2005") that should do itOn 8/9/05, Øyvind <[EMAIL PROTECTED]> wrote: Hello.I need to run a program(http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp)thru Python. It is normally run such as "upti

Re: [Tutor] Deleting an entry from a dictionary

2005-08-03 Thread Adam Bark
Oh yeah using del is better. I was typing as Danny sent his reply so I didn't realise untill after I had sent that.On 8/3/05, Smith, Jeff < [EMAIL PROTECTED]> wrote: Although that works, I kinda prefer     del meals['breakfast'] since that explicitly indicates what is going on.   Speaking of

Re: [Tutor] Deleting an entry from a dictionary

2005-08-02 Thread Adam Bark
meals.pop(key) will do it. Example: >>> meals = {} >>> meals['breakfast'] = 'slimfast' >>> meals['lunch'] = 'slimfast' >>> meals['dinner'] = 'something sensible' >>> meals {'lunch': 'slimfast', 'breakfast': 'slimfast', 'dinner': 'something sensible'} >>> meals.pop("breakfast") 'slimfast' >>> meals

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Adam Bark
dents.keys():     out_file.write(x+","+max_points[x]+"\n")    out_file.closeOn 8/1/05, Adam Bark <[EMAIL PROTECTED]> wrote: >>> max_points = [25,25,50,25,100] >>> assignments = ['hw ch 1','hw ch 2','quiz   ','hw ch 3','test&#x

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Adam Bark
>>> max_points = [25,25,50,25,100] >>> assignments = ['hw ch 1','hw ch 2','quiz   ','hw ch 3','test'] >>> students = {'#Max':max_points} >>> students {'#Max': [25, 25, 50, 25, 100]} The problem is the key in students is a list not an integer.On 8/1/05, Nathan Pinno <[EMAIL PROTECTED] > wrote:

Re: [Tutor] Socket Programming

2005-08-01 Thread Adam Bark
Hi Joe you can use 1 and just send 'Hi!' as long as something else isn't likely to be sent at the same time. It will just read what is in that socket when you call it so if something else that you don't want is there just behind what you're after then you could end up with that as well.On 8/1/0

Re: [Tutor] Socket Programming

2005-08-01 Thread Adam Bark
You have to put in how many bytes of data you want to recieve in clientsocket.recv() eg. clientsocket.recv(1024) for 1kB.On 7/31/05, Joseph Quigley < [EMAIL PROTECTED]> wrote:Hi Dan, Danny Yoo wrote:>##>clientsocket.recv()>##>>should work better.>>Ok well I tried your examples but they didn

Re: [Tutor] How do I make Python draw?

2005-07-27 Thread Adam Bark
Hey luke what kind of game is it? Can I have a look when at your source as well? Cheers. AdamOn 7/27/05, luke <[EMAIL PROTECTED]> wrote: > Thanks. Will ask if I have any more questions. Maybe I won't have to go to> Visual Basic to write my games. Maybe Python will do the trick.Oh my god.Don't ever

Re: [Tutor] Please Help: Hacking

2005-07-22 Thread Adam Bark
How to become a hackerOn 7/17/05, Suranga Sarukkali < [EMAIL PROTECTED]> wrote: Python's Great fro Hacking Right? Please tell me more like when you tell it to a College Student (That tell's What I'm) and since I Sort of new to Programming in Python it's going be easy if done so. Please rep

Re: [Tutor] use gzip with large files

2005-07-19 Thread Adam Bark
If you use something like this: for line in file.readlines(): then line is a string to the next newline and it automatically detects the EOF and the same with file.readline() but that will give you one character at a time.On 7/19/05, frank h. <[EMAIL PROTECTED]> wrote: hello allI am trying to wri

Re: [Tutor] Catching OLE error

2005-07-14 Thread Adam Bark
I just noticed you put OLEError before the colon you should have except:     OLEError     print "ole" if that doesn't work you could just get rid of the OLEError bit and all errors will be ignored.On 7/14/05, Bernard Lebel < [EMAIL PROTECTED]> wrote:Very well.#INFO : < NewRenderShot > importAnimat

[Tutor] Catching OLE error

2005-07-14 Thread Adam Bark
Can you send me the output for an OLE error? The correct syntax should be included in the error message like this: Traceback (most recent call last):   File "", line 1, in ? TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' TypeError would be the exception so you would have: try

Re: [Tutor] Another newbie question from Nathan.

2005-07-10 Thread Adam Bark
If I understand your problem correctly all you need to do is use the name of the function to call it ie: def func():     print "hello world" func() would give the output "hello world"On 7/10/05, Nathan Pinno <[EMAIL PROTECTED]> wrote:   Hi all,  How do I make Python get a def? Is it the "get" f

Re: [Tutor] A more Pythonic way to do this

2005-06-30 Thread Adam Bark
r that.  And yes, it works now ;) it's lovely.~DeniseOn 6/30/05, Adam Bark <[EMAIL PROTECTED]> wrote: > Here's the problem -->> enemyship_sprites.add(Enemy((cols*60)+20, (rows*40)+30),> level)>> 1,2   12> 1  0> you&

Re: [Tutor] A more Pythonic way to do this

2005-06-30 Thread Adam Bark
Here's the problem --> enemyship_sprites.add(Enemy((cols*60)+20, (rows*40)+30), level)     1,2   1    2    1  0 you've put a braket after +30 which ends the Enemy call. The numbering is +1 for op

[Tutor] wxPython shaped window

2005-06-30 Thread Adam Bark
On 6/26/05, Adam Cripps <[EMAIL PROTECTED]> wrote: On 6/25/05, Adam Bark <[EMAIL PROTECTED]> wrote:> Thanks for the info Adam I just seem to be having a problem with the panel > size it greys out nearly all the image. Ideally I would like to make the > panel transparent but

  1   2   >