Re: [Tutor] Sorting Data in Databases

2009-11-22 Thread Ken G.
I have not use the DBMS as I am unaware of them in both languages. Lie Ryan wrote: Ken G. wrote: The way I use to do it in another programming language (Liberty Basic in Windows) was: 1. Count number of data entry in database. 2. Dimension or create an array to equal the maximum number of

Re: [Tutor] Sorting Data in Databases

2009-11-22 Thread Lie Ryan
Ken G. wrote: The way I use to do it in another programming language (Liberty Basic in Windows) was: 1. Count number of data entry in database. 2. Dimension or create an array to equal the maximum number of entry. 3. Copy data entry from database into array. 4. Use the SORT command on array, as

[Tutor] Sorting Data in Databases

2009-11-22 Thread Ken G.
Greeting: Can someone give me a brief outline of sorting data in databases? I have five databases with numeric values for each item. To be more precise, they are sorted by date and if necessary, by time. Currently, I am using Ubuntu 9.04 in the language of Linux and Python is my choice of pr

Re: [Tutor] multiple assignment on one line

2009-11-22 Thread bob gailer
Shashwat Anand wrote: Ok, this is silly but i want to know is multiple assignment is possible in one line using "+=, -=, *= etc" operators on python 2.6.4 Read the manual: 6.3.1 Augmented assignment statements "target augop expression_list An augmented assignment evaluates the target (which, u

Re: [Tutor] multiple assignment on one line

2009-11-22 Thread Lie Ryan
Alan Gauld wrote: "Lie Ryan" wrote I was a bit surprised this doesn't work though: a, b += k, k What would you expect? I expect a, b += c, d to be a += c; b += d just like a, b = c, d to be a = c; b = d Remember that a,b = c,d is just tuple assignment without using parens (and pare

Re: [Tutor] multiple assignment on one line

2009-11-22 Thread Shashwat Anand
Ohh, I never thought it this way. Thanks for enlightening. On Sun, Nov 22, 2009 at 9:52 PM, Alan Gauld wrote: > > "Lie Ryan" wrote > > > I was a bit surprised this doesn't work though: > >> >> a, b += k, k >> >> > What would you expect? > Remember that > > a,b = c,d > > is just tuple assignment

Re: [Tutor] About classes and databases

2009-11-22 Thread Alan Gauld
"Michele Alzetta" wrote First problem: when creating each instance of the class I have to pass it the information necessary to create the correct datetime objects - how would I do this? Same way you do any otrher kind of initialisation as arguments to the init method. In fact you could cr

Re: [Tutor] multiple assignment on one line

2009-11-22 Thread Alan Gauld
"Lie Ryan" wrote I was a bit surprised this doesn't work though: a, b += k, k What would you expect? Remember that a,b = c,d is just tuple assignment without using parens (and parens are not part of the tuple definition) So using tuples a,b += k,k would unwrap as a,b = (a,b) + (k,k

Re: [Tutor] About classes and databases

2009-11-22 Thread Kent Johnson
On Sun, Nov 22, 2009 at 4:12 AM, Michele Alzetta wrote: > Hallo all! > > Long time since I last dabbled in python :-( > > I was thinking of a possible solution to a problem I have: I could make a > Class which contains, amongst other things, a couple of datetime.datetime > objects. > The class als

Re: [Tutor] About classes and databases

2009-11-22 Thread Dave Angel
Michele Alzetta wrote: Hallo all! Long time since I last dabbled in python :-( I was thinking of a possible solution to a problem I have: I could make a Class which contains, amongst other things, a couple of datetime.datetime objects. The class also will have to contain an element taken from a

Re: [Tutor] multiple assignment on one line

2009-11-22 Thread Luke Paireepinart
On Sun, Nov 22, 2009 at 2:30 AM, Shashwat Anand wrote: > Ok, this is silly but i want to know is multiple assignment is possible in > one line using "+=, -=, *= etc" operators on python 2.6.4 > > like a,b = 0,1 which is equal to > a = 0 > b = 1 > on seperate lines. > similarly a = b = 0 which is e

Re: [Tutor] multiple assignment on one line

2009-11-22 Thread Lie Ryan
Alan Gauld wrote: "Shashwat Anand" wrote Can we pack these two statements in one line ? a += k b += k of course a,b +=k will not work but is there any such option available? Not that I'm aware. And when I tried it just to see what happens it killed IDLE completely - Window disappeared

Re: [Tutor] multiple assignment on one line

2009-11-22 Thread Lie Ryan
Shashwat Anand wrote: Ok, this is silly but i want to know is multiple assignment is possible in one line using "+=, -=, *= etc" operators on python 2.6.4 like a,b = 0,1 which is equal to a = 0 b = 1 on seperate lines. similarly a = b = 0 which is equal to a = 0 b = 0 on seperate lines. Can we

[Tutor] About classes and databases

2009-11-22 Thread Michele Alzetta
Hallo all! Long time since I last dabbled in python :-( I was thinking of a possible solution to a problem I have: I could make a Class which contains, amongst other things, a couple of datetime.datetime objects. The class also will have to contain an element taken from a Tuple and various elemen

Re: [Tutor] multiple assignment on one line

2009-11-22 Thread Shashwat Anand
thanks Alan, i was just curious, thats it. And yeah, simplest is best :) On Sun, Nov 22, 2009 at 2:38 PM, Alan Gauld wrote: > > "Shashwat Anand" wrote > > > Can we pack these two statements in one line ? >> a += k >> b += k >> > > of course a,b +=k will not work but is there any such option av

Re: [Tutor] multiple assignment on one line

2009-11-22 Thread Alan Gauld
"Shashwat Anand" wrote Can we pack these two statements in one line ? a += k b += k of course a,b +=k will not work but is there any such option available? Not that I'm aware. And when I tried it just to see what happens it killed IDLE completely - Window disappeared and everything! Y

[Tutor] multiple assignment on one line

2009-11-22 Thread Shashwat Anand
Ok, this is silly but i want to know is multiple assignment is possible in one line using "+=, -=, *= etc" operators on python 2.6.4 like a,b = 0,1 which is equal to a = 0 b = 1 on seperate lines. similarly a = b = 0 which is equal to a = 0 b = 0 on seperate lines. Can we pack these two statement