Re: [newbie] help with pygame-tutorial

2012-04-10 Thread aapeetnootjes
Op maandag 9 april 2012 22:51:48 UTC+2 schreef Roy Smith het volgende: > In article > <1a558398-3984-4b20-8d67-a0807871b...@v1g2000yqm.googlegroups.com>, > aapeetnootjes wrote: > > > I'm trying out the pygame tutorial at > > http://www.pygame.org/docs/tut/intro/intro.html > > If I try out the

Re: [newbie] help with pygame-tutorial

2012-04-09 Thread Roy Smith
In article <1a558398-3984-4b20-8d67-a0807871b...@v1g2000yqm.googlegroups.com>, aapeetnootjes wrote: > I'm trying out the pygame tutorial at > http://www.pygame.org/docs/tut/intro/intro.html > If I try out the code I'm facing an error: > ./game.py: line 4: syntax error at unexpected symbol 'si

Re: [newbie] help with pygame-tutorial

2012-04-09 Thread MRAB
On 09/04/2012 21:20, aapeetnootjes wrote: I'm trying out the pygame tutorial at http://www.pygame.org/docs/tut/intro/intro.html If I try out the code I'm facing an error: ./game.py: line 4: syntax error at unexpected symbol 'size' ./game.py: line 4: `size = width, height = 320, 240' can anyone

Re: Newbie Help

2012-01-11 Thread mixolydian
mixolydian wrote: >I want to get into Python progamming for both local database applications and >dynamic web pages. Maybe some Q&D scripts. >There is a ton of excellent language books. > >I have downloaded and installed 2.7.2 and got it working by pasting samples >into IDLE, and uploading to my

Re: Newbie Help

2012-01-04 Thread Ben Finney
Ben Finney writes: > * Cross-platform, so that you're not denied the use of any popular > workstation OS. > > For my purposes, either { GNU Screen + Bash + Emacs } or { GNU Screen + > Bash + Vim } are good choices satisfying all the above criteria. There > may be other good combinations. I sli

Re: Newbie Help

2012-01-04 Thread HoneyMonster
On Tue, 03 Jan 2012 17:13:17 -0600, mixolydian wrote: > I want to get into Python progamming for both local database > applications and dynamic web pages. Maybe some Q&D scripts. I am new to Python too, and recently completed my first "real" cross- platform GUI application with local/remote datab

Re: Newbie Help

2012-01-03 Thread Steven D'Aprano
On Tue, 03 Jan 2012 17:13:17 -0600, mixolydian wrote: > I would like some advice on: > 1. IDEs Avoid them. Everything you need can be used with two applications: - a programmer's text editor; - a decent terminal (console) application. A decent text editor will allow you to have multiple files

Re: Newbie Help

2012-01-03 Thread Ben Finney
mixolydian writes: > I want to get into Python progamming for both local database > applications and dynamic web pages. Maybe some Q&D scripts. Welcome to the Python community. You have found a good general-purpose programming language, and I hope you find the right help for what you're trying t

Re: Newbie help - Programming the Semantic Web with Python

2011-07-16 Thread Bruce Whealton
those included modules would have to get compiled with the rest of the code for it to work, right? Bruce -Original Message- From: Chris Angelico Sent: Saturday, July 09, 2011 10:10 PM To: python-list@python.org Subject: Re: Newbie help - Programming the Semantic Web with Python On Sun, Jul

Re: Newbie help - Programming the Semantic Web with Python

2011-07-11 Thread Bruce Whealton
This didn't seem to work either. I was getting errors the number of arguments expected being two, when I changed to def add (self, args): I seem to remember that if I removed the parentheses around sub, pred, obj, it worked. I thought that was how it worked. What is strange is that this is n

Re: Newbie help - Programming the Semantic Web with Python

2011-07-10 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.10 02:28 PM, Bruce Whealton wrote: > If you know of any good resources for finding python applications on > the web, this might be a good way to learn. I don't know if I > should look for Python applications, or if I'll have more luck

Re: Newbie help - Programming the Semantic Web with Python

2011-07-10 Thread Bruce Whealton
n the web, this might be a good way to learn. I don't know if I should look for Python applications, or if I'll have more luck looking for Python Libraries. Thanks, Bruce -Original Message- From: Andrew Berg Sent: Saturday, July 09, 2011 10:44 PM To: comp.lang.python Subje

Re: Newbie help - Programming the Semantic Web with Python

2011-07-09 Thread Andrew Berg
On 2011.07.09 08:32 PM, Bruce Whealton wrote: > Hello, > So, I got this book on Programming the Semantic Web about > the same time I started learning Python. The code seems to be > developed for python 2.7 and not 3, I believe. If you're going to learn Python 3, I suggest learning from

Re: Newbie help - Programming the Semantic Web with Python

2011-07-09 Thread Chris Angelico
On Sun, Jul 10, 2011 at 11:32 AM, Bruce Whealton wrote: problem with is this line: >     def add(self, (sub, pred, obj)): > I think the problem is with the parentheses before the sub.  I removed those > and that seemed to fix that error or make it go away.  I don’t remember how I > figured that

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 21:27:12 -0800, Nav wrote: > @ Steven > "No, you're confused -- the problem isn't with using the global > namespace. > The problem is that you don't know what names you want to use ahead of > time. " > > Actually I know what the names would be and how I want to use them.

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
"> if yes then: > if using globalnamespace is bad then why does every book or tutorial > about python classes give the above style of assignment as an > example? That's a basic assignment example. It's not a direct manipulation of globals(), like the solution given by Jan, which you seem to fee

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Dave Angel
(You top-posted. It's polite on most newsgroups, and specifically on this one to add your comments *following* the quoted earlier text) Nav wrote: Okay, let me ask another question: When we create instances of objects by doing x = className () are we using globalnamespace? If that line ap

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread alex23
On Jan 5, 1:12 pm, Nav wrote: > When we create instances of objects by doing > x = className () > are we using globalnamespace? Well, you're using a namespace, which namespaces its in would depend on the scope in which that assignment occurred. And there's not really a global namespace, only modu

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 19:12:53 -0800, Nav wrote: > Okay, let me ask another question: > > When we create instances of objects by doing > x = className() > are we using globalnamespace? That depends on whether you are doing x = className() inside a function (or class), or in the top level of the

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
Thanks for pointing it out Steve. The blog post doesn't explain it very well. I understand the risk of exec or eval(input). but what are the risks of globalnamespace use and what are the benefits? -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
Okay, let me ask another question: When we create instances of objects by doing x = className () are we using globalnamespace? if yes then: if using globalnamespace is bad then why does every book or tutorial about python classes give the above style of assignment as an example? Second why do

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread alex23
On Jan 5, 9:33 am, Nav wrote: > what are the risks of globalnamespace use You're unnecessarily tying your code to the implementation. > and what are the benefits? Absolutely none that using a dictionary doesn't also give you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
Thanks Jan, You read my mind. That is exactly what I needed. Thanks for showing the product function from itertools as well. It seems easier to grasp than the nested loops, I had been using. I noticed chopin.edu.pl. Are you a musician? Nav -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Steve Holden
Nav wrote: > On Jan 4, 4:54 pm, Chris Rebert wrote: >> On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: >>> You could put them in a dictionary with the key being the name, instead of >>> a list. >> To illustrate that for the OP: >> >> name2drink = {} >> for booze in liquors: >> for juic

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Shawn Milochik
On Jan 4, 2010, at 5:59 PM, Nav wrote: > On Jan 4, 4:54 pm, Chris Rebert wrote: >> On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: >>> You could put them in a dictionary with the key being the name, instead of >>> a list. >> >> To illustrate that for the OP: >> >> name2drink = {} >> fo

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
On Jan 4, 4:54 pm, Chris Rebert wrote: > On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: > > You could put them in a dictionary with the key being the name, instead of > > a list. > > To illustrate that for the OP: > > name2drink = {} > for booze in liquors: >     for juice in juices: >  

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Jan Kaliszewski
2010-01-04, 22:54:41 Chris Rebert wrote: name2drink = {} for booze in liquors: for juice in juices: name = juice +" "+booze # or however you're naming them drink = Bottle(booze, juice) name2drink[name] = drink @Nav: ...and if you really desire to have those objects

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Chris Rebert
On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: > You could put them in a dictionary with the key being the name, instead of a > list. To illustrate that for the OP: name2drink = {} for booze in liquors: for juice in juices: name = juice +" "+booze # or however you're naming t

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Shawn Milochik
You could put them in a dictionary with the key being the name, instead of a list. Shawn -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help for using multiprocessing and subprocess packages for creating child processes

2009-06-16 Thread Mike Kazantsev
On Tue, 16 Jun 2009 23:20:05 +0200 Piet van Oostrum wrote: > > Matt (M) wrote: > > >M> Try replacing: > >M> cmd = [ "ls /path/to/file/"+staname+"_info.pf" ] > >M> with: > >M> cmd = [ “ls”, “/path/to/file/"+staname+"_info.pf" ] > > In addition I would like to remark that -- if the o

Re: Newbie help for using multiprocessing and subprocess packages for creating child processes

2009-06-16 Thread Piet van Oostrum
> Matt (M) wrote: >M> Try replacing: >M> cmd = [ "ls /path/to/file/"+staname+"_info.pf" ] >M> with: >M> cmd = [ “ls”, “/path/to/file/"+staname+"_info.pf" ] In addition I would like to remark that -- if the only thing you want to do is to start up a new command with subprocess.Popen -

Re: Newbie help for using multiprocessing and subprocess packages for creating child processes

2009-06-16 Thread Rob Newman
Thanks Matt - that worked. Kind regards, - Rob On Jun 16, 2009, at 12:47 PM, Matt wrote: Try replacing: cmd = [ "ls /path/to/file/"+staname+"_info.pf" ] with: cmd = [ “ls”, “/path/to/file/"+staname+"_info.pf" ] Basically, the first is the conceptual equivalent of executing the following

Re: Newbie help for using multiprocessing and subprocess packages for creating child processes

2009-06-16 Thread Matt
Try replacing: cmd = [ "ls /path/to/file/"+staname+"_info.pf" ] with: cmd = [ “ls”, “/path/to/file/"+staname+"_info.pf" ] Basically, the first is the conceptual equivalent of executing the following in BASH: ‘ls /path/to/file/FOO_info.pf’ The second is this: ‘ls’ ‘/path/to/file/FOO_info.pf

Re: Newbie help (TypeError: int argument required)

2008-06-08 Thread bukzor
On Jun 8, 11:43 am, Iain Adams <[EMAIL PROTECTED]> wrote: > Hi, > > I am new to python. I have been having trouble using the MysqlDB. I > get an error pointing from the line > > cursor.execute("UPDATE article SET title = %s, text = %s WHERE id = > %u", (self.title, self.text, self.id)) > > Here is

Re: Newbie help (TypeError: int argument required)

2008-06-08 Thread [EMAIL PROTECTED]
On Jun 8, 1:43 pm, Iain Adams <[EMAIL PROTECTED]> wrote: > Hi, > > I am new to python. I have been having trouble using the MysqlDB. I > get an error pointing from the line > > cursor.execute("UPDATE article SET title = %s, text = %s WHERE id = > %u", (self.title, self.text, self.id)) > > Here is t

Re: (Newbie) Help with sockets.

2008-02-29 Thread mentaltruckdriver
On Feb 29, 9:42 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >> You claim to be writing a telnet server, yet I don't see any > >> code that actually implements the telnet protocol. Different > >> telnet clients default to different m

Re: (Newbie) Help with sockets.

2008-02-29 Thread Grant Edwards
On 2008-02-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> You claim to be writing a telnet server, yet I don't see any >> code that actually implements the telnet protocol. Different >> telnet clients default to different modes, so if you want them >> in a certain mode, you have to put them i

Re: (Newbie) Help with sockets.

2008-02-29 Thread mentaltruckdriver
On Feb 28, 11:22 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-29, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > > En Fri, 29 Feb 2008 00:20:26 -0200, <[EMAIL PROTECTED]> escribió: > > >> Hi everyone. I'm fairly new to Python, and even more new to socket > >> programming. I think I'v

Re: (Newbie) Help with sockets.

2008-02-28 Thread Grant Edwards
On 2008-02-29, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Fri, 29 Feb 2008 00:20:26 -0200, <[EMAIL PROTECTED]> escribió: > >> Hi everyone. I'm fairly new to Python, and even more new to socket >> programming. I think I've wrapped my head around sockets, and with >> that I want to create a Te

Re: (Newbie) Help with sockets.

2008-02-28 Thread Gabriel Genellina
En Fri, 29 Feb 2008 00:20:26 -0200, <[EMAIL PROTECTED]> escribió: > Hi everyone. I'm fairly new to Python, and even more new to socket > programming. I think I've wrapped my head around sockets, and with > that I want to create a Telnet-based chat server, the idea being > people connect to the tel

Re: (Newbie) Help with sockets.

2008-02-28 Thread Miki
Hello, > Hi everyone. I'm fairly new to Python, and even more new to socket > programming. I think I've wrapped my head around sockets, and with > that I want to create a Telnet-based chat server, the idea being > people connect to the telnet servers with their clients and they all > communicate.

Re: Newbie help understanding...

2007-05-26 Thread cmpython
The problem is that in your function t is a string (one of the cards in the list called "cards") and strings don't have the ability to use the append method. But lists do. Therefore t.append is wrong but cards.append works fine. (Append means "take the list you have and add what is in the parent

Re: Newbie help understanding...

2007-05-26 Thread Amit Khemka
On 26 May 2007 00:23:32 -0700, mark <[EMAIL PROTECTED]> wrote: > Hi I am trying to get a piece of code to work based on an exercise in > a book. Any help appreciated. Can someone please explain what is going > on here. > > I am trying to read from a text file a list of cards with the > following fo

Re: Newbie help with array handling

2007-04-12 Thread Shane Geiger
""" Since you are a beginner and since RCCILA (Runnable, Commented Code Is Least Ambiguous) I'm proving this example code to help you get used to manipulating data with python. This should give you an idea of how to juggle a bit. After you learn how to do this you likely still will not be

Re: Newbie help with array handling

2007-04-12 Thread 7stud
On Apr 12, 3:50 am, "7stud" <[EMAIL PROTECTED]> wrote: > On Apr 12, 3:31 am, "loial" <[EMAIL PROTECTED]> wrote: > > lst = mydict["keyvalue1"] > lst[0] = 4 > list.append("red") Rather the last line there should read: lst.append("red") -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help with array handling

2007-04-12 Thread 7stud
On Apr 12, 3:31 am, "loial" <[EMAIL PROTECTED]> wrote: > OK, thanks for the replies > > One other thing...I need to update the values since they are basically > totals that I am accumulating. > > How do I update a specific value for a specific key? mydict["keyvalue1"] returns the value, which in

Re: Newbie help with array handling

2007-04-12 Thread loial
OK, thanks for the replies One other thing...I need to update the values since they are basically totals that I am accumulating. How do I update a specific value for a specific key? -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help with array handling

2007-04-12 Thread 7stud
loial wrote: > I am new to python and am converting an awk script to python > > I need to store some data in an array/table of some form > > keyvalue1, value1, value2, value3 > keyvalue2, value1,value2, value3 > keyvalue3, value1,value2,value3 > etc > > I will later need to sort in keyvalue order

Re: Newbie help with array handling

2007-04-12 Thread Bruno Desthuilliers
loial a écrit : > I am new to python and am converting an awk script to python > > I need to store some data in an array/table of some form > > keyvalue1, value1, value2, value3 > keyvalue2, value1,value2, value3 > keyvalue3, value1,value2,value3 > etc data = dict( keyvalue1=[value11, value12

Re: Newbie help with array handling

2007-04-12 Thread bearophileHUGS
loial: > I am new to python and am converting an awk script to python It seems there are many people trying to convert awk code to Python :-) > I need to store some data in an array/table of some form > keyvalue1, value1, value2, value3 > keyvalue2, value1,value2, value3 > keyvalue3, value1,valu

Re: Newbie help with array handling

2007-04-12 Thread bruce peng
use dir with list nested for example: {key1 : [value1, value2, value3], key2 : [value1, value2, vlaue4]} "loial" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am new to python and am converting an awk script to python > > I need to store some data in an array/table of some form

Re: Newbie help with array handling

2007-04-12 Thread rishi pathak
do something like this {keyvalue1:[ value1, value2, value3],keyvalue2:[value1,value2, value3],keyvalue3,:[value1,value2,value3]} On 12 Apr 2007 00:58:54 -0700, loial <[EMAIL PROTECTED]> wrote: I am new to python and am converting an awk script to python I need to store some data in an array/ta

Re: Newbie help looping/reducing code

2007-02-19 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: >Lance Hoffmeyer <[EMAIL PROTECTED]> writes: >> def even_odd_round(num): >> if(round(num,2) + .5 == int(round(num,2)) + 1): >> if num > .5: >> if(int(num) % 2): >>

Re: Newbie help looping/reducing code

2007-02-19 Thread Paul Rubin
Lance Hoffmeyer <[EMAIL PROTECTED]> writes: > def even_odd_round(num): > if(round(num,2) + .5 == int(round(num,2)) + 1): > if num > .5: >if(int(num) % 2): > num = round(num,2) + .1 #an odd number >else: >

Re: Newbie help looping/reducing code

2007-02-19 Thread Paul Rubin
Lance Hoffmeyer <[EMAIL PROTECTED]> writes: > T2B = even_odd_round(float(str(T2B))) > VS = even_odd_round(float(str(VS))) > SS = even_odd_round(float(str(SS))) > sh.Cells(21,lastcol+1).Value = float(str(T2B))/100 > sh.Cells(22,lastcol+1).Value = float(str(VS))/100 > sh.Cells(23,lastcol+1).Va

Re: Newbie help - test for data type

2006-07-31 Thread Bruno Desthuilliers
Rob Wolfe wrote: >> This is my function: >> selecteddeptcodes = context.REQUEST.DEPTCODE >> currentstatus = context.REQUEST.STATUS >> >> if currentstatus == 'pending': >> for dptcd in selecteddeptcodes: >>context.changetolive(DEPTCODE=dptcd) >> if currentstatus == 'old': >> for dptcd in selec

Re: Newbie help - test for data type

2006-07-31 Thread Bruno Desthuilliers
Dennis Benzinger wrote: > Jonathan Bowlas wrote: >> Hi Listers, >> >> I have a requirement to test for a data type could someone tell me if >> this >> is possible in python? >> >> Basically I have a ZPT in Zope that users can select checkboxes in a form >> which pass arguments for a python function

Re: Newbie help - test for data type

2006-07-31 Thread Bruno Desthuilliers
John Machin wrote: > Jonathan Bowlas wrote: >> Hi Listers, >> >> I have a requirement to test for a data type could someone tell me if this >> is possible in python? >> >> Basically I have a ZPT in Zope that users can select checkboxes in a form >> which pass arguments for a python function, howeve

Re: Newbie help - test for data type

2006-07-31 Thread Rob Wolfe
> This is my function: > selecteddeptcodes = context.REQUEST.DEPTCODE > currentstatus = context.REQUEST.STATUS > > if currentstatus == 'pending': > for dptcd in selecteddeptcodes: >context.changetolive(DEPTCODE=dptcd) > if currentstatus == 'old': > for dptcd in selecteddeptcodes: >contex

Re: Newbie help - test for data type

2006-07-31 Thread Jonathan Bowlas
Thanks for everyone’s help, much appreciated, I’ll check out the isinstance function.   Jon   -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dennis Benzinger Sent: 31 July 2006 10:20 To: python-list@python.org Subject: Re: Newbie help - test

Re: Newbie help - test for data type

2006-07-31 Thread Dennis Benzinger
Jonathan Bowlas wrote: > Hi Listers, > > I have a requirement to test for a data type could someone tell me if this > is possible in python? > > Basically I have a ZPT in Zope that users can select checkboxes in a form > which pass arguments for a python function, however if there is only one > c

Re: Newbie help - test for data type

2006-07-31 Thread John Machin
Jonathan Bowlas wrote: > Hi Listers, > > I have a requirement to test for a data type could someone tell me if this > is possible in python? > > Basically I have a ZPT in Zope that users can select checkboxes in a form > which pass arguments for a python function, however if there is only one > che

Re: Newbie Help!

2006-02-06 Thread bwaha
> 3. Any good ebooks or links to start with. (according to the web this is the > best place to start.) If you get the point of wantig to buy a book, I can recommend Python Visual Quickstart Guide by Chris Fhris Fehily as a very good text for beginners. I has helped me a lot. -- http://mail.py

Re: Newbie Help!

2006-02-05 Thread jmdeschamps
Alex Martelli wrote: > Stephen <[EMAIL PROTECTED]> wrote: > > > Hi All, > > im new to python i just have a few questions and was wondering if > > you could help me?? > > > > 1. what programming langaugue does python use? or which is most popular? > > Python _is_ a programming language, so

Re: Newbie Help!

2006-02-05 Thread Arthur Cannell
Stephen wrote: > Hi All, > im new to python i just have a few questions and was wondering if > you could help me?? > > 1. what programming langaugue does python use? or which is most popular? > > 2. Does anyone know where i could get hold of practice code > > 3. Any good ebooks or links

Re: Newbie Help!

2006-02-05 Thread Alex Martelli
Stephen <[EMAIL PROTECTED]> wrote: > Hi All, > im new to python i just have a few questions and was wondering if > you could help me?? > > 1. what programming langaugue does python use? or which is most popular? Python _is_ a programming language, so your question is not clear. If you'r

Re: newbie help needed

2005-11-14 Thread Fredrik Lundh
"john boy" <[EMAIL PROTECTED]> wrote: > I am running the following program: > > def print Multiples (n, high): > i = 1 > while i <= high: > print n*i, ' \t' , > i = i + 1 > print > def printMultTable (high): > i = 1 > while i <= high: > print Multip

Re: Newbie: Help Figger Out My Problem

2005-06-29 Thread bruno modulix
[EMAIL PROTECTED] wrote: > Thanks to all who replied. I did not ask for other iterations of my > program. I asked what was wrong with it. Please understand that usenet is not a commercial support service. Everyone is free to answer how he likes. Or not to answer at all... -- bruno desthuilliers

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread ChuckDubya
Thanks to all who replied. I did not ask for other iterations of my program. I asked what was wrong with it. To those who did just that, explained what was wrong, thank you for answering my question. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread Casey Hawthorne
It may be shorter but it keeps the entire list in memory and has to iterate over the list twice! Does he/she need the entire list? import random heads = 0 flips = 100 for i in xrange(flips): if random.randint(0,1): heads += 1 print "Heads:%s" % heads print "Tails:%s" % (flips - heads) "D

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread Devan L
import random flips = 100 results = [random.randint(0,1) for i in range(flips)] heads = results.count(0) tails = results.count(1) print "Heads:%s" % heads print "Tails:%s" % tails I think this is more compact. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread Scott David Daniels
db wrote: > On Tue, 28 Jun 2005 00:23:30 -0700, ChuckDubya wrote: >>... if flips >= 99: >>print "Heads: " + heads >>print "Tails: " + tails >>print "Total: " + flips + "flips" >>raw_input("Press the enter key to exit.")... > > Your programm gives an error. You are trying to

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread bruno modulix
[EMAIL PROTECTED] wrote: > ##Coin Flip: randomly flips 100 "coins" and prints results > ##Original draft: june 27, 2005 > ##Chuck > > import random > heads = 0 > tails = 0 > flips = 0 > while flips < 99: > coin = random.randrange(0, 2) > if coin == 0: > heads = heads +

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread qwweeeit
Hi, About the error, you already got the answer from the "experts". Beeing almost a newbie, I tried instead an elaboration of your example, using lists. Furthermore I timed the two methods and to my surprise the "list method" takes longer: # Head_Tail.py import random, time nStart= time.time() #

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread db
On Tue, 28 Jun 2005 00:23:30 -0700, ChuckDubya wrote: > ##Coin Flip: randomly flips 100 "coins" and prints results > ##Original draft: june 27, 2005 > ##Chuck > > import random > heads = 0 > tails = 0 > flips = 0 > while flips < 99: > coin = random.randrange(0, 2) > if coin == 0:

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread Paul Rubin
[EMAIL PROTECTED] writes: > When I save and run this "program", I get a DOS window that flashes at > me and disappears. What's wrong with it? You can't just click the file.py icon and expect a program like that to do something reasonable. There are two ways to deal with it: 1) start a DOS box a

Re: newbie help

2005-03-24 Thread Robert Kern
[EMAIL PROTECTED] wrote: Hello, Thanks to all for great responses. Here's what iam trying to do. I am writing a script to generate test patterns. What is a test pattern? Anyways, the time you've spent here so far could have been more profitably spent reading the Tutorial[1], any one of the fine i

Re: newbie help

2005-03-24 Thread [EMAIL PROTECTED]
Hello, Thanks to all for great responses. Here's what iam trying to do. I am writing a script to generate test patterns. For this i am passing an index number, size and a opcode from the command line testit -i -s [-o ] When the user passes the index number(1 or 2), it maps to one of the buffers

Re: newbie help

2005-03-24 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > I did something like this. > index is passed from the command line. > > def __getBuffer( index): > if index == 1: > buf1 = [None] * 512 > print "Buffer: %s" % (buf1) > return buf1 > elif index == 2: > buf2

Re: newbie help

2005-03-24 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Here it is again. I did something like this. index is passed from the command line. def __getBuffer( index): if index == 1: buf1 = [None] * 512 print "Buffer: %s" % (buf1) return buf1 elif index == 2: buf2 = [None] * 512 print

Re: newbie help

2005-03-24 Thread [EMAIL PROTECTED]
Here it is again. I did something like this. index is passed from the command line. def __getBuffer( index): if index == 1: buf1 = [None] * 512 print "Buffer: %s" % (buf1) return buf1 elif index == 2: buf2 = [None] * 512 print "Buffer: %s" % (buf2)

Re: newbie help

2005-03-24 Thread [EMAIL PROTECTED]
I did something like this. index is passed from the command line. def __getBuffer( index): if index == 1: buf1 = [None] * 512 print "Buffer: %s" % (buf1) return buf1 if index == 2: buf2 = [None] * 512 print "Buffer: %s" % (buf1) return buf2 Is thi

Re: newbie help

2005-03-23 Thread Stephen Thorne
On 23 Mar 2005 16:05:58 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I want to pass and index number and a file name from the command line. > This index number corresponds to a buffer. I need to maintain 2 such > buffers for my test. > > In C you would do someting like this > unsigned ch

Re: newbie help

2005-03-23 Thread andrea
[EMAIL PROTECTED] wrote: I want to pass and index number and a file name from the command line. This index number corresponds to a buffer. I need to maintain 2 such buffers for my test. Passing options is very easy, just import sys and you can find your options in sys.argv. To do something mor

Re: newbie help

2005-03-23 Thread Lonnie Princehouse
buf1 = [None] * 512 buf2 = [None] * 512 (Not quite the same as C because the list isn't filled with gibberish...) -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie help

2005-03-23 Thread [EMAIL PROTECTED]
I want to pass and index number and a file name from the command line. This index number corresponds to a buffer. I need to maintain 2 such buffers for my test. In C you would do someting like this unsigned char buf1[512]; In python is this as simple as? buf 1 = 512 buf 2 = 512 And how do i keep

Re: newbie help

2005-03-23 Thread Lonnie Princehouse
How about describing what your program is supposed to /do/ instead of posting C code? What are the "buffers" for? This group might be more helpful if you did that. If you really do need this sort of random-access character buffer, you have a couple of options. Python strings aren't mutable, so t

Re: newbie help

2005-03-23 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, ashokbellur wrote: > main() > { >unsigned char buf1[512]; >unsigned char buf2[512]; >CODE code = TEST1 > ># The index number is passed from the command line ># It corresponds to one of the two buffers > ># if index = 1 corresponds to buf1 and if in

Re: newbie help

2005-03-23 Thread ashokbellur
Here's some changes to the code main() { unsigned char buf1[512]; unsigned char buf2[512]; CODE code = TEST1 # The index number is passed from the command line # It corresponds to one of the two buffers # if index = 1 corresponds to buf1 and if index = 2 corresponds to buf2

Re: newbie help

2005-03-23 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > [snipped snippet] > > This is snippet code trying to generate some test patterns. That snippet of code doesn't compile. At least not with gcc. > How do i manage multiple buffers in python. Is it possible? > > > If the index number at command

Re: newbie, help with pythonpath

2005-03-04 Thread Eduardo Suarez
What do i need to add to the path? I have already tried the same with the PYTHONPATH variable. Thanks in advance, -Eduardo [otto:eduardo/ 501]$ python Python 2.3.5 (#2, Feb 9 2005, 00:38:15) [GCC 3.3.5 (Debian 1:3.3.5-8)] on linux2 Type "help", "copyright", "credits" or "license" for more inform

Re: newbie, help with pythonpath

2005-03-03 Thread Peter Hansen
Eduardo Suarez wrote: In order not to make a mess my system, i have installed a packaged called pygtkglext in /usr/local/pygtkglext instead of /usr/local (using the --prefix in ./configure). Hence, i have the directories /usr/local/pygtkglext-1.0.1/lib/python2.3/site-packages/gtk-2.0/gtk/gtkgl /

Re: newbie, help with pythonpath

2005-03-03 Thread Chmouel Boudjnah
Eduardo Suarez wrote: I'm trying to set the python path variable so i can use them, but i haven't got it. Any hint? sys.path.append('/usr/blah/blah/blah/directory') -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie help for mod_python

2005-02-23 Thread Jochen Kaechelin
Am Mittwoch, 23. Februar 2005 00:29 schrieb Brian Beck: > Jochen Kaechelin wrote: > > I run debian sid and apache2 with libapache2-mod-python2.3 > > and I added these lines > > > > > >AddHandler mod_python .py > >PythonDebug On > > > > > > in a virtualhost container. > > Were those the on

Re: newbie help for mod_python

2005-02-22 Thread Brian Beck
Jochen Kaechelin wrote: I run debian sid and apache2 with libapache2-mod-python2.3 and I added these lines AddHandler mod_python .py PythonDebug On in a virtualhost container. Were those the only lines you added? You also should have actually loaded the module somewhere by adding something

Re: Newbie help

2005-02-15 Thread Chad Everett
I got it, thanks for the help. Chad "Michael Hartl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sorry about the code: Google Groups screwed up the formatting, but I > hope you get the picture. > -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help

2005-02-15 Thread Chad Everett
No problem, I need all the help and insruction I can get. Thanks, Chad "Kent Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Kent Johnson wrote: >> You might be interested in the Python tutor mailing list which is >> specifically intended for beginners. >> http://mail.pyt

Re: Newbie help

2005-02-14 Thread Kent Johnson
Kent Johnson wrote: You might be interested in the Python tutor mailing list which is specifically intended for beginners. http://mail.python.org/mailman/listinfo/tutor Ah, I don't mean to imply that this list is unfriendly to beginners, or that you are not welcome here! Just pointing out another

Re: Newbie help

2005-02-14 Thread Kent Johnson
Chad Everett wrote: Nope, I am trying to learn it on my own. I am using the book by Michael Dawson. You might be interested in the Python tutor mailing list which is specifically intended for beginners. http://mail.python.org/mailman/listinfo/tutor Kent -- http://mail.python.org/mailman/listinf

Re: Newbie help

2005-02-14 Thread Scott David Daniels
Francis Girard wrote: Mmm. This very much look like a homework from school. Right ? Francis Girard Le lundi 14 Février 2005 04:03, Chad Everett a écrit : Hey guys, Hope you can help me again with another problem. I am >>trying to learn Python on my own and need some help with ... It could also be

  1   2   >