[Tutor] sqlite3 Python25 parameter binding problem with UPDATE please help

2008-12-01 Thread aivars
Hello, Does sqlite3 in python 2.5 supports parameter bindings in UPDATE statement? When I do like the following: oCon.execute("UPDATE rezerve SET latusaldo =? where gads =?;",(result, [year])) oCon.commit() it throws me the error: sqlite3.InterfaceError: error binding parameter 1 probably unsupp

[Tutor] noise function

2008-12-01 Thread Christopher Spears
Hi! Does anyone know if python has a noise function? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] I asked about loops

2008-12-01 Thread WM.
and your response was most gratifying. I think that I now have a handle on the subject and want to say, "Thanks to you all." WM ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] attribute of built-in type

2008-12-01 Thread Kent Johnson
Here is an idea that might help - you do have some control over assignment to attributes of an object. If you stored your objects in another object you could assign __name__ attributes automatically. For example: class Container(object): def __setattr__(self, name, value): if no

Re: [Tutor] 'for' loops

2008-12-01 Thread Kent Johnson
On Mon, Dec 1, 2008 at 7:56 PM, John Fouhy <[EMAIL PROTECTED]> wrote: > [1] Technically, it iterates over an iterator, which you can think of > as an object that behaves like a list when you throw it at a for loop. The object of the 'in' must be an iterable, which is an object that can produce an

Re: [Tutor] try except block for multiple statements

2008-12-01 Thread bob gailer
Bryan Fodness wrote: I would like to use a try except to see if a value exists. But, when I use the following, if a does not exist it exits. I understand why this does this, but is there a way to get b,c, and d if a does not exist without using a try except for every statement? try: fo

Re: [Tutor] try except block for multiple statements

2008-12-01 Thread John Fouhy
On 02/12/2008, Bryan Fodness <[EMAIL PROTECTED]> wrote: > I would like to use a try except to see if a value exists. But, when I use > the following, if a does not exist it exits. I understand why this does > this, but is there a way to get b,c, and d if a does not exist without using > a try exc

[Tutor] try except block for multiple statements

2008-12-01 Thread Bryan Fodness
I would like to use a try except to see if a value exists. But, when I use the following, if a does not exist it exits. I understand why this does this, but is there a way to get b,c, and d if a does not exist without using a try except for every statement? try: fo.write("a = %s\n" %plan.a)

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Alan Gauld
"Erica Osher" <[EMAIL PROTECTED]> wrote I wrote the original code in a program called Processing. ( http://processing.org/) Having had a look at the web site it is obvious that the hardest bit of porting the Processing code to Python is that Python does not support all the visual drawing func

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Alan Gauld
"Erica Osher" <[EMAIL PROTECTED]> wrote I wrote the original code in a program called Processing. ( http://processing.org/) Aha! The language is actually called Processing. Now that's a new one on me. Thanks for the link, it does help to have the context. :-) Now the next question, are y

Re: [Tutor] Tutor Digest, Vol 58, Issue 2

2008-12-01 Thread Alan Gauld
"W W" <[EMAIL PROTECTED]> wrote for x in range(3): but the OP was looping from 3 to 1, and that's the easiest way I knew of. Yes, but they weren't using the counter so it didn't matter which way they looped. I suspect the decrement pattern was just the one they were most familiar with in

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Erica Osher
I wrote the original code in a program called Processing. ( http://processing.org/) Thanks for your advice, I definitely need some tutorials. On Mon, Dec 1, 2008 at 8:23 PM, Alan Gauld <[EMAIL PROTECTED]>wrote: > "Erica Osher" <[EMAIL PROTECTED]> wrote > > The code was originally created for a

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Alan Gauld
"Erica Osher" <[EMAIL PROTECTED]> wrote The code was originally created for a Processing Project and I'm just starting to learn python and I'd like to build on this code. The fact that you still don't tell us what the original language is suggests you are not a very experienced programmer i

Re: [Tutor] 'for' loops

2008-12-01 Thread Alan Gauld
"WM." <[EMAIL PROTECTED]> wrote I recently asked a question about 'for' loops, expecting them to be similar to 'for-next' loops. I have looked at several on-line tutors but am still in the dark about what 'for' loops do. Python for loops are like foreach loops in other languages. A Python fo

Re: [Tutor] 'for' loops

2008-12-01 Thread John Fouhy
On 02/12/2008, WM. <[EMAIL PROTECTED]> wrote: > I recently asked a question about 'for' loops, expecting them to be similar > to 'for-next' loops. I have looked at several on-line tutors but am still > in the dark about what 'for' loops do. > Does anyone have a plain English about the use of 'for

Re: [Tutor] 'for' loops

2008-12-01 Thread W W
On Mon, Dec 1, 2008 at 6:44 PM, WM. <[EMAIL PROTECTED]> wrote: > I recently asked a question about 'for' loops, expecting them to be similar > to 'for-next' loops. I have looked at several on-line tutors but am still > in the dark about what 'for' loops do. > Does anyone have a plain English abou

Re: [Tutor] 'for' loops

2008-12-01 Thread Steve Willoughby
On Mon, Dec 01, 2008 at 04:44:02PM -0800, WM. wrote: > I recently asked a question about 'for' loops, expecting them to be > similar to 'for-next' loops. I have looked at several on-line tutors but > am still in the dark about what 'for' loops do. > Does anyone have a plain English about the use

[Tutor] 'for' loops

2008-12-01 Thread WM.
I recently asked a question about 'for' loops, expecting them to be similar to 'for-next' loops. I have looked at several on-line tutors but am still in the dark about what 'for' loops do. Does anyone have a plain English about the use of 'for' loops? Are 'while' loops the only way Python runs

Re: [Tutor] Tutor Digest, Vol 58, Issue 2

2008-12-01 Thread W W
On Mon, Dec 1, 2008 at 5:24 PM, Alan Gauld <[EMAIL PROTECTED]>wrote: > Since the OP isn't using the loop counter a simpler solution > is simply > > for x in range(3): but the OP was looping from 3 to 1, and that's the easiest way I knew of. -Wayne ___

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Steve Willoughby
On Mon, Dec 01, 2008 at 06:40:03PM -0500, Erica Osher wrote: > The code was originally created for a Processing Project and I'm just > starting to learn python and I'd like to build on this code. > > The syntax error I get is > > *Traceback (most recent call last): > File "nodebox/gui/mac/__ini

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Erica Osher
The code was originally created for a Processing Project and I'm just starting to learn python and I'd like to build on this code. The syntax error I get is *Traceback (most recent call last): File "nodebox/gui/mac/__init__.pyo", line 332, in _compileScript File "", line 8 int x1 = 5;

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Alan Gauld
"Erica Osher" <[EMAIL PROTECTED]> wrote I have a simple processing code that I'm trying to work with in python, but I keep getting syntax errors. Any help on changing the code would be greatly appreciated. Thanks. It would help to have some background. What language are you translating from

Re: [Tutor] Tutor Digest, Vol 58, Issue 2

2008-12-01 Thread Alan Gauld
"W W" <[EMAIL PROTECTED]> wrote for x in xrange(3, 0, -1): : print x : : 3 2 1 Since the OP isn't using the loop counter a simpler solution is simply for x in range(3): i,j,k = 3,3,3 while i != 1: print 'Larry, Moe & Curly Joe!' i -= 1 while j != 1: pr

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Steve Willoughby
On Mon, Dec 01, 2008 at 12:59:23PM -0800, Steve Willoughby wrote: > > void drawSquare1() { > > if(x1<0 || x1>width-size) { > > x1Speed = -x1Speed; > > } > > > > if(y1<0 || y1>height-size) { > > y1Speed = -y1Speed; > > } > > def drawSquare1(): > if (x1 < 0 or x1 > width-size): > x1 +

Re: [Tutor] converting processing code to python code

2008-12-01 Thread Steve Willoughby
On Mon, Dec 01, 2008 at 03:48:59PM -0500, Erica Osher wrote: > I have a simple processing code that I'm trying to work with in python, but > I keep getting syntax errors. Any help on changing the code would be greatly > appreciated. Thanks. Could you show us what you have so far in Python and what

[Tutor] converting processing code to python code

2008-12-01 Thread Erica Osher
I have a simple processing code that I'm trying to work with in python, but I keep getting syntax errors. Any help on changing the code would be greatly appreciated. Thanks. void setup() { size(550, 500); noStroke(); smooth(); fill(255, 255, 255, 150); } //Square 1 vars int x1 = 5; int y1 =

Re: [Tutor] Tutor Digest, Vol 58, Issue 2

2008-12-01 Thread W W
Try this: for x in xrange(3, 0, -1): : print x : : 3 2 1 HTH, Wayne On Mon, Dec 1, 2008 at 2:20 PM, WM. <[EMAIL PROTECTED]> wrote: > Stooges.py > > i,j,k = 3,3,3 > while i != 1: >print 'Larry, Moe & Curly Joe!' >i -= 1 >while j != 1: >print 'Go Mad!

Re: [Tutor] Tutor Digest, Vol 58, Issue 2

2008-12-01 Thread WM.
Stooges.py i,j,k = 3,3,3 while i != 1: print 'Larry, Moe & Curly Joe!' i -= 1 while j != 1: print 'Go Mad!!' j -= 1 while k != 1: print 'Go-go bad-bad!!' k -= 1 print '\nBye-bye.' I am trying to learn loops. These nested 'whiles' work OK but I would like to

Re: [Tutor] attribute of built-in type

2008-12-01 Thread spir
Kent Johnson a écrit : [...big snip...] > Do you know that you can probably just assign a __name__ attribute to > the objects? Or name, or whatever you like? > > In [13]: class Foo(object): pass >: > > In [14]: f=Foo() > > In [15]: f.name > ---

Re: [Tutor] Reading gzip files

2008-12-01 Thread Kent Johnson
On Sun, Nov 30, 2008 at 9:42 PM, Dinesh B Vadhia <[EMAIL PROTECTED]> wrote: > Strangely, for the files that don't work I can read/print the file almost to > the end and then it falls over with the CRC error. That's because the CRC isn't checked until after the file is read; as you can see from th