Re: [Tutor] Scrolling through output in shell

2008-11-19 Thread Mike Hoy
os.system("cat textfile | less") did the trick, thanks everyone. On Wed, Nov 19, 2008 at 2:34 PM, Lie Ryan <[EMAIL PROTECTED]> wrote: > On Mon, 17 Nov 2008 09:20:55 -0500, Shawn Milochik wrote: > >> On Sun, Nov 16, 2008 at 1:21 PM, Mike Hoy <[EMAIL PROTECTED]> wrote: >>> I'm writing a small progr

Re: [Tutor] what do you use @staticmethod for?

2008-11-19 Thread wesley chun
On 11/19/08, Alan Gauld <[EMAIL PROTECTED]> wrote: > "spir" <[EMAIL PROTECTED]> wrote > >> I have not yet found any use for this feature. > > Which makes it very different to an instance method. instance > methods act on instances. class methods act on the entire > class - ie they can affect all of

Re: [Tutor] what do you use @staticmethod for?

2008-11-19 Thread Alan Gauld
"spir" <[EMAIL PROTECTED]> wrote I have not yet found any use for this feature. While there are subtle differences I believe the biggest reason for both being present is history. static methods were there first then class methods were added soon after and are slightly more flexible. But static

Re: [Tutor] Scrolling through output in shell

2008-11-19 Thread Alan Gauld
"Lie Ryan" <[EMAIL PROTECTED]> wrote both "more" and "less". The most striking difference between "more" and "less" is that "more" is simple forward-only, you can't scroll up, only down. "less" support both backward and forward navigation. On very early Unices that was true but for the last

[Tutor] what do you use @staticmethod for?

2008-11-19 Thread spir
Good night, I have not yet found any use for this feature. Also, I do not really understand the difference with @classmethod, from the programmer's points of view (even if I get the difference on the python side). As I see it, a classmethod is a very ordinary method, except its 'owner' is a ty

Re: [Tutor] Scrolling through output in shell

2008-11-19 Thread Lie Ryan
On Mon, 17 Nov 2008 09:20:55 -0500, Shawn Milochik wrote: > On Sun, Nov 16, 2008 at 1:21 PM, Mike Hoy <[EMAIL PROTECTED]> wrote: >> I'm writing a small program that writes to a text file. I want to be >> able to view the contents of the text file inside of shell. But the >> file is too large for a

Re: [Tutor] Help Optimise Code

2008-11-19 Thread Lie Ryan
On Wed, 19 Nov 2008 13:13:18 +, Richard Lovely wrote: > I'm pretty new to code optimisation, so I thought I'd ask you all for > advice. > > I'm making an iterative prime number generator. This is what I've got so > far: > > Code: Select all > import math, array > > def count2(start_at=0): >

Re: [Tutor] Help Optimise Code

2008-11-19 Thread Kent Johnson
On Wed, Nov 19, 2008 at 8:13 AM, Richard Lovely <[EMAIL PROTECTED]> wrote: > I'm pretty new to code optimisation, so I thought I'd ask you all for advice. > > I'm making an iterative prime number generator. You might be interested in this recipe and discussion: http://code.activestate.com/recipes

Re: [Tutor] sqlite3 lists to database conversion/ using python variables in sqlite3

2008-11-19 Thread Kent Johnson
On Wed, Nov 19, 2008 at 6:48 AM, शंतनू (Shantanoo) <[EMAIL PROTECTED]> wrote: > You may try: > c.execute("insert into ABC(%s) values('%s')" % (list1_value, list2_value)) This is a bad idea for reasons I gave in a previous email. Kent ___ Tutor maillist

Re: [Tutor] sqlite3 lists to database conversion/ using python variables in sqlite3

2008-11-19 Thread Kent Johnson
On Wed, Nov 19, 2008 at 7:21 AM, amit sethi <[EMAIL PROTECTED]> wrote: > Thanks Kent , very useful reply but the thing is i actually want to use this > in a program that stores ID3 tags and they are broken more usually than not > .. so I actually don't know what keys/attributes i would be sending c

[Tutor] Help Optimise Code

2008-11-19 Thread Richard Lovely
I'm pretty new to code optimisation, so I thought I'd ask you all for advice. I'm making an iterative prime number generator. This is what I've got so far: Code: Select all import math, array def count2(start_at=0): 'Yield every third integer, beginning with start_at' # this has been tes

Re: [Tutor] sqlite3 lists to database conversion/ using python variables in sqlite3

2008-11-19 Thread Kent Johnson
On Wed, Nov 19, 2008 at 6:18 AM, amit sethi <[EMAIL PROTECTED]> wrote: list1=['hello','hi'] list2=['a','b'] c.execute('''create table ABC(hello text,hi text)''') list1_value= ",".join(list1) list2_value= ",".join(list2) c.execute('''insert into ABC (%s) values (%s

Re: [Tutor] sqlite3 lists to database conversion/ using python variables in sqlite3

2008-11-19 Thread शंतनू (Shantanoo)
On Wed, Nov 19, 2008 at 4:48 PM, amit sethi <[EMAIL PROTECTED]> wrote: > Hi , i am trying to learn python and this is my first time with any > databases . I am using sqlite3 to create a database of my music files and > its > metadata tags so here is what i wanted to do . Two list one of the > attri

[Tutor] sqlite3 lists to database conversion/ using python variables in sqlite3

2008-11-19 Thread amit sethi
Hi , i am trying to learn python and this is my first time with any databases . I am using sqlite3 to create a database of my music files and its metadata tags so here is what i wanted to do . Two list one of the attributes and one of their values ,how do i put it in the database.Here is a simple c