Re: [Tutor] What is the square bracket about?

2006-07-22 Thread Danny Yoo
>> def adder1(*args): >> print 'adder1', >> if type(args[0]) == type(0): >> sum = 0 >> else: >> sum = args[0][:0] >> for arg in args: >> sum = sum + arg >> return sum This function looks overly enamored with Python slicing. *grin* Unless I'm m

Re: [Tutor] loops to assign variables

2006-07-22 Thread Dave Kuhlman
On Sat, Jul 22, 2006 at 01:41:17PM -0400, Kent Johnson wrote: > Dave Kuhlman wrote: [snip] > > And, also, that's why the following statements all have exactly > > the same effect: > > > > total = 5 > > locals()['total'] = 5 > > exec('total = 5') > > You're not in the mood to believe

Re: [Tutor] lists and recursion

2006-07-22 Thread Gabriel Farrell
On Sat, Jul 22, 2006 at 06:20:12AM -0400, Kent Johnson wrote: > We just had a discussion of recursion, you might want to look at it - > though the code is a bit more complex than this example. > http://mail.python.org/pipermail/tutor/2006-July/048081.html Glad to see I'm not the only one to get t

Re: [Tutor] loops to assign variables

2006-07-22 Thread Kent Johnson
Dave Kuhlman wrote: > On Sat, Jul 22, 2006 at 11:37:38AM -0400, Python wrote: > >> >> Well the reference documentation says: >> >> locals( >> ) >> Update and return a dictionary representing the current local >> symbol table. Warning: The contents of this dictionary should >>

Re: [Tutor] search path

2006-07-22 Thread Christopher Arndt
johnsonv3 schrieb: > When one installs a program (such as Panda or Livewires) into python > sitepackage folder is the python search path automnatically updated to > search the newly installed folders and files? Generally speaking, yes. The Python package (to use the proper name) either needs to ha

Re: [Tutor] search path

2006-07-22 Thread Christopher Arndt
johnsonv3 schrieb: > If one does this... > > import sys > sys.path.append("C:\\panda\direct") > > Is the change to python search path only temporary? Yes, it only changes the search path within that program. The system-wide default search path is not changed. Chris ___

Re: [Tutor] search path

2006-07-22 Thread Dave Kuhlman
On Sat, Jul 22, 2006 at 09:57:01AM -0400, johnsonv3 wrote: > Hi, > > If one does this... > > import sys > sys.path.append("C:\\panda\direct") > > Is the change to python search path only temporary? > Thanks. As we quibblers like to say, That depends on the meaning of the word "temporary". Modi

Re: [Tutor] loops to assign variables

2006-07-22 Thread Dave Kuhlman
On Sat, Jul 22, 2006 at 11:37:38AM -0400, Python wrote: > On Sat, 2006-07-22 at 17:18 +0200, Karl Pflästerer wrote: > > On 22 Jul 2006, [EMAIL PROTECTED] wrote: > > > > > > > > On Sat, 2006-07-22 at 14:11 +0100, John CORRY wrote: > > >> Hi, > > >> > > >> I am refactoring my code. I am trying to

Re: [Tutor] What is the square bracket about?

2006-07-22 Thread Dave Kuhlman
On Sat, Jul 22, 2006 at 08:49:52PM +0800, Ivan Low wrote: > def adder1(*args): > print 'adder1', > if type(args[0]) == type(0): > sum = 0 > > else: > sum = args[0][:0] > for arg in args: > sum = sum + arg > > return sum > > Hi, I was trying to

[Tutor] starting a program from python

2006-07-22 Thread johnsonv3
Hi, Using Windows XP Home & python 234 I am trying to start python programs that run Panda 3D without having to open command prompt and type a path every time I run a program.   This pandastart.bat file works...   cd C:\Panda3D-1.2.3\mystuff ppython bvd.py   and from python shell this works...

Re: [Tutor] loops to assign variables

2006-07-22 Thread Python
On Sat, 2006-07-22 at 17:18 +0200, Karl Pflästerer wrote: > On 22 Jul 2006, [EMAIL PROTECTED] wrote: > > > > > On Sat, 2006-07-22 at 14:11 +0100, John CORRY wrote: > >> Hi, > >> > >> I am refactoring my code. I am trying to reduce the amount of lines > >> by using more loops. I tend to use cop

Re: [Tutor] loops to assign variables

2006-07-22 Thread Karl Pflästerer
On 22 Jul 2006, [EMAIL PROTECTED] wrote: > > On Sat, 2006-07-22 at 14:11 +0100, John CORRY wrote: >> Hi, >> >> I am refactoring my code. I am trying to reduce the amount of lines >> by using more loops. I tend to use copy and paste a lot instead of >> writing a loop to do the work. >> >> For

[Tutor] search path

2006-07-22 Thread johnsonv3
Another search path question   When one installs a program (such as Panda or Livewires) into python sitepackage folder is the python search path automnatically updated to search the newly installed folders and files? ___ Tutor maillist - Tutor@pyth

[Tutor] search path

2006-07-22 Thread johnsonv3
Hi,   If one does this...   import sys sys.path.append("C:\\panda\direct")   Is the change to python search path only temporary? Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] loops to assign variables

2006-07-22 Thread Python
On Sat, 2006-07-22 at 14:11 +0100, John CORRY wrote: > Hi, > > I am refactoring my code. I am trying to reduce the amount of lines > by using more loops. I tend to use copy and paste a lot instead of > writing a loop to do the work. > > For example, I have 30 textentry boxes numbered from ent

[Tutor] loops to assign variables

2006-07-22 Thread John CORRY
Hi,   I am refactoring my code.  I am trying to reduce the amount of lines by using more loops.  I tend to use copy and paste a lot instead of writing a loop to do the work.   For example, I have 30 textentry boxes numbered from entry20 to entry50.  I have used the following code to ass

[Tutor] What is the square bracket about?

2006-07-22 Thread Ivan Low
def adder1(*args): print 'adder1', if type(args[0]) == type(0): sum = 0 else: sum = args[0][:0] for arg in args: sum = sum + arg return sum Hi, I was trying to understand what this function is all about. I didn't tried the adder1 function which

Re: [Tutor] : finding out if the horizontal scrollbar on a Tix.CheckList is being used or not

2006-07-22 Thread Michael Lange
On Fri, 21 Jul 2006 15:01:30 -0400 Orri Ganel <[EMAIL PROTECTED]> wrote: > As a follow up to my last email, I think the issue is more that the > display doesn't update before the command associated with the "search" > button has finished processing, so any attempts to get data about the > displ

Re: [Tutor] lists and recursion

2006-07-22 Thread Kent Johnson
Christopher Spears wrote: > I am working out of How To Think Like A Computer > Scientist. Here is the code for a module called > node.py: > > def printList(node): > nodeList = [] > while node: > nodeList.append(node.cargo) > n