Re: [Tutor] Looking for a Pythonic way to pass variable number of lists to zip()

2005-03-21 Thread Sean Perry
Tony Cappellini wrote: I have a program which currently passes 6 lists as arguments to zip(), but this could easily change to a larger number of arguments. Would someone suggest a way to pass a variable number of lists to zip() ? well, I would have said "apply(zip, (l1, l2, l3, ...))" but apply

Re: [Tutor] OT - SQL methodology.

2005-03-21 Thread Liam Clarke
Brilliant, thanks Sean. On Mon, 21 Mar 2005 22:37:14 -0800, Sean Perry <[EMAIL PROTECTED]> wrote: > Liam Clarke wrote: > > Hi, > > > > This is a SQL query for the advanced db gurus among you (I'm looking at > > Kent...) > > > > After I've run an insert statement, should I get the new primary ke

Re: [Tutor] OT - SQL methodology.

2005-03-21 Thread Sean Perry
Liam Clarke wrote: Hi, This is a SQL query for the advanced db gurus among you (I'm looking at Kent...) After I've run an insert statement, should I get the new primary key (it's autoincrementing) by using PySQLite's cursor.lastrowid in a select statement, or is there a more SQLish way to do this

[Tutor] Looking for a Pythonic way to pass variable number of lists to zip()

2005-03-21 Thread Tony Cappellini
I have a program which currently passes 6 lists as arguments to zip(), but this could easily change to a larger number of arguments. Would someone suggest a way to pass a variable number of lists to zip() ? ___ Tutor maillist - Tutor@python.org http:

[Tutor] OT - SQL methodology.

2005-03-21 Thread Liam Clarke
Hi, This is a SQL query for the advanced db gurus among you (I'm looking at Kent...) After I've run an insert statement, should I get the new primary key (it's autoincrementing) by using PySQLite's cursor.lastrowid in a select statement, or is there a more SQLish way to do this? In the SQL book

Re: [Tutor] Help with unnamed arguments in a merge function

2005-03-21 Thread Colin Corr
On Wed, 2005-03-16 at 02:45 -0500, Brian van den Broek wrote: > Colin Corr said unto the world upon 2005-03-16 01:38: > > Greetings Tutors, > > > > I am having some difficulties with the concept of functions which can > > accept an unnamed number of arguments. Specifically, when trying to > > writ

Re: [Tutor] automatically extending PYTHONPATH?

2005-03-21 Thread Kent Johnson
Kent Johnson wrote: As Liam suggested, you can walk the dir yourself and modify sys.path. The walk code could be in a site-customize.py file in site-packages so it will be run automatically every time Python starts up. Oops, as Brian correctly pointed out, the correct file name is sitecustomize.p

Re: [Tutor] automatically extending PYTHONPATH?

2005-03-21 Thread Kent Johnson
You can create a .pth file in site-packages. See these links for details: http://docs.python.org/inst/search-path.html#SECTION00041 http://bob.pythonmac.org/archives/2005/02/06/using-pth-files-for-python-development/ As Liam suggested, you can walk the dir yourself and modify sys.pa

Re: [Tutor] import statements in functions?

2005-03-21 Thread Alan Gauld
> Is there a convention to be considered for deciding if import > statements should be included in a function body? The convention is for all imports to be at the top of a module. > def specialFunction(): > import foo_special > doSomethingSpecial() BUt I copnfess I do o

Re: [Tutor] import statements in functions?

2005-03-21 Thread Sean Perry
Marcus Goldfish wrote: Is there a convention to be considered for deciding if import statements should be included in a function body? For example, which of these two module layouts would be preferable: imports are cached. So once it is imported, it stays imported. The reason I consider the secon

Re: [Tutor] python console, IDLE startup scripts

2005-03-21 Thread Brian van den Broek
Marcus Goldfish said unto the world upon 2005-03-21 17:06: Is there a special startup script the command-line python IDE and/or IDLE use? As per Liam's response to my previous post, I would like to use os.walk() to automatically set my sys.path() variable... Marcus

[Tutor] python console, IDLE startup scripts

2005-03-21 Thread Marcus Goldfish
Is there a special startup script the command-line python IDE and/or IDLE use? As per Liam's response to my previous post, I would like to use os.walk() to automatically set my sys.path() variable... Marcus ___ Tutor maillist - Tutor@python.org http:/

Re: [Tutor] automatically extending PYTHONPATH?

2005-03-21 Thread Liam Clarke
No automatic method, afaik, but why not just do an os.walk() in conjunction with sys.append()? Regards, Liam Clarke On Mon, 21 Mar 2005 16:33:20 -0500, Marcus Goldfish <[EMAIL PROTECTED]> wrote: > I am using Python 2.4/IDLE on WinXP. I organize my sourcefiles in a > directory tree, similar to

[Tutor] import statements in functions?

2005-03-21 Thread Marcus Goldfish
Is there a convention to be considered for deciding if import statements should be included in a function body? For example, which of these two module layouts would be preferable: # --- MyModule1.py - import foo1, foo2, foo3 import foo_special # several coherent funct

[Tutor] automatically extending PYTHONPATH?

2005-03-21 Thread Marcus Goldfish
I am using Python 2.4/IDLE on WinXP. I organize my sourcefiles in a directory tree, similar to the convention used in Java. When I create a new subdirectory, though, I have to either (i) manually edit my PYTHONPATH environment variable, or (ii) do a sys.append() in IDLE for the new scripts to be

Re: [Tutor] print command

2005-03-21 Thread Alan Gauld
> You can get full control of the output by using sys.stdout.write() instead of print. Note the > arguments to write() must be strings: > > import sys > sys.stdout.write(str(1)) > sys.stdout.write(str(2)) > sys.stdout.write(str(3)) > sys.stdout.write('\n') > > Or you can accumulate the values into

Re: [Tutor] Re: [Pythoncard-users] global menubar

2005-03-21 Thread Alan Gauld
> Thanks for the thoughts. I noticed that you didn't post directly to the > PythonCard users list, so you might not be reading the discussion Nope, I just replied to a message on Tutor... > followed. It sounds like MDI applications are deprecated under Windows, Under XP thats true, in earlier v

Re: [Tutor] Accessing List items

2005-03-21 Thread Bill Mill
On Mon, 21 Mar 2005 11:57:21 +, Matt Williams <[EMAIL PROTECTED]> wrote: > Dear List, > > Thanks for the help with the previous problem - now all solved! > > I have a question about accessing lists. I'm trying to do something to > each item in a list, and then assign it back into the list, ov

[Tutor] reg: readline module

2005-03-21 Thread kedar thangudu
hi, I hav been working on python in developing pyshell... I am using python readline module to for the command line.. Can u help me with how to replace or erase the current readline line-buffer.. the readline module just provides a insert_text func which is appending the text to the line-buff

Re: [Tutor] Accessing List items

2005-03-21 Thread Max Noel
On Mar 21, 2005, at 12:57, Matt Williams wrote: for i in range(len(y)): y[i]="z" print y Surely there must be a better way than this ? Sounds like a job for... list comprehensions! (cue cheesy superhero music) y = ["z" for i in y] -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look

[Tutor] Accessing List items

2005-03-21 Thread Matt Williams
Dear List, Thanks for the help with the previous problem - now all solved! I have a question about accessing lists. I'm trying to do something to each item in a list, and then assign it back into the list, overwriting the old value. However, the first loop here doesn't work, whereas the second lo

Re: [Tutor] print command

2005-03-21 Thread Kent Johnson
Shitiz Bansal wrote: Now this is so basic, i am feeling sheepish asking about it. I am outputting to the terminal, how do i use a print command without making it jump no newline after execution, which is the default behaviour in python. To clarify: print 1 print 2 print 3 I want output to be 123