Re: What do you use as symbols for Python ?

2005-11-11 Thread Peter Otten
Daniel Evers wrote: > I mixed this with the class-version and created a new class derived from > "str" for easier printing and added an iterator: > > --- > > class Enum: > class Type(str): > def __init__(self, name): > self.__name = name >

Re: Python obfuscation

2005-11-11 Thread The Eternal Squire
Without copyright, how could one possibly earn a living writing a novel? And I submit that many ISD's are only a single person burning with that one software idea of a lifetime, the equivalent of the Great American Novel. Are we to punish that impulse by denying that person a legal monopoly on t

Re: changeing users on linux

2005-11-11 Thread darkchild50
the password is for loging into root -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-11 Thread Peter Otten
[EMAIL PROTECTED] wrote: > However, I found something interesting which I don't quite understand : > > list((x for x in [1,2,3] if x<2 or stop())) works > > but > > a = [ x for x in [1,2,3] if x <2 or stop() ] doesn't. Here's how Carl Banks explained it to me when Bengt came up with this tric

Re: Dynamically Update Class Definitions?

2005-11-11 Thread Jean-Paul Calderone
On Sat, 12 Nov 2005 06:24:57 GMT, Chris Spencer <[EMAIL PROTECTED]> wrote: >Chris Spencer wrote: >> Alex Martelli wrote: > >>> If you're in no hurry, you COULD loop over all of gc.get_objects(), >>> identify all those which are instances of old_class and "somehow" change >>> their classes to new_cl

Re: Python obfuscation

2005-11-11 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 10 Nov 2005 21:41:52 -0800, Alex Martelli wrote: > > >> Obfuscation has it's place. > > > > What I think of this thesis is on a par of what I think of this way of > > spelling the possessive adjective "its" (and equally unprintable in > > poli

Re: Dynamically Update Class Definitions?

2005-11-11 Thread Chris Spencer
Chris Spencer wrote: > Alex Martelli wrote: >> If you're in no hurry, you COULD loop over all of gc.get_objects(), >> identify all those which are instances of old_class and "somehow" change >> their classes to new_class -- of course, x.__class__ = new_class may >> well not be sufficient, in which

Re: Python obfuscation

2005-11-11 Thread Mike Meyer
My, we're about to get *seriously* off topic. Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Fri, 11 Nov 2005 11:17:43 -0500, Mike Meyer wrote: >>> I'd just like to make it non-trivial to make or use additional copies. >> How do you do that without infringing my fair use rights? > And that is th

Re: Dynamically Update Class Definitions?

2005-11-11 Thread Chris Spencer
Alex Martelli wrote: > <[EMAIL PROTECTED]> wrote: > > >>Is there a way to loop through all instantiated objects and update >>their classes when a source file changes? I know about Michael Hudson's >>method >>(http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164), but >>you have to modif

Re: list of lambda

2005-11-11 Thread Bengt Richter
On Sat, 12 Nov 2005 14:55:31 +1100, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Sat, 12 Nov 2005 00:17:59 +0100, jena wrote: > >> hello, >> when i create list of lambdas: >> l=[lambda:x.upper() for x in ['a','b','c']] >> then l[0]() returns 'C', i think, it should be 'A' > >What is wrong with j

Re: Python obfuscation

2005-11-11 Thread Steven D'Aprano
On Thu, 10 Nov 2005 21:41:52 -0800, Alex Martelli wrote: >> Obfuscation has it's place. > > What I think of this thesis is on a par of what I think of this way of > spelling the possessive adjective "its" (and equally unprintable in > polite company). Aside: given that "it's" is "it is", how wou

Re: directory listing

2005-11-11 Thread Michael Konrad
Sorry about that, I guess send was working. Michael Konrad wrote: > > This is what I decided on for a solution. I haven't tested it > cross-platform yet. > > import os > > def dirListing(directory='/Users/mkonrad'): > """Returns a list of directories.""" > #variables > d

Re: Python obfuscation

2005-11-11 Thread Steven D'Aprano
On Fri, 11 Nov 2005 08:11:32 -0800, petantik wrote: > the argument that most people buy software rather than get a pirated > version depends on the country that they are in e.g. china's piracy > problem where shops sell pirated software with no retribution by the > state - remember china is abou

Re: directory listing

2005-11-11 Thread Michael Konrad
This is what I decided on for a solution. I haven't tested it cross-platform yet. import os def dirListing(directory='/Users/mkonrad'): """Returns a list of directories.""" #variables dirs = [] #list of directories

Re: directory listing

2005-11-11 Thread Michael Konrad
This is what I decided on for a solution. I haven't tested it cross-platform yet. import os def dirListing(directory='/Users/mkonrad'): """Returns a list of directories.""" #variables dirs = [] #list of directories

Re: list of lambda

2005-11-11 Thread Bengt Richter
On 11 Nov 2005 18:28:22 -0800, Paul Rubin wrote: >jena <[EMAIL PROTECTED]> writes: >> l=[lambda:x.upper() for x in ['a','b','c']] >> then l[0]() returns 'C', i think, it should be 'A' > >Yeah, this is Python late binding, a standard thing to get confused >over. You want

Re: Python obfuscation

2005-11-11 Thread Steven D'Aprano
On Fri, 11 Nov 2005 11:17:43 -0500, Mike Meyer wrote: >> I'd just like to make it non-trivial to make or use additional copies. > > How do you do that without infringing my fair use rights? And that is the million dollar question. So-called "intellectual property" is a government-granted monop

Re: changeing users on linux

2005-11-11 Thread Mike Meyer
[EMAIL PROTECTED] writes: > how would i go about makeing a program in python that asks for username > and password and changes to that user? For some definition of "changes to that user": # Untested code from pwd import getpwnam from os import setuid setuid(getpwnam(raw_input("Who do you want to

how to think like a computer scientist

2005-11-11 Thread john boy
Question for the following program: sec 5.5   def factorial (n):    if n == 0:   return 1    else:   recurse = factorial (n-1)   result = n * recurse   return result   How come whenever I state the function with "n" given a value it prints no results in the interpreter for EX:   de

Re: list of lambda

2005-11-11 Thread Steven D'Aprano
On Sat, 12 Nov 2005 00:17:59 +0100, jena wrote: > hello, > when i create list of lambdas: > l=[lambda:x.upper() for x in ['a','b','c']] > then l[0]() returns 'C', i think, it should be 'A' What is wrong with just doing this? L = [x.upper() for x in ['a', 'b', 'c']] py> L = [lambda: x.upper()

Re: Hash map with multiple keys per value ?

2005-11-11 Thread Robert Kern
Chris Stiles wrote: > Hi -- > > I'm working on something that includes the concept of multiple aliases for a > particular object, where a lookup for any of the aliases has to return all the > others. The hack way of doing this was to have a dictionary where each > entry consisted of a list of al

Re: help make it faster please

2005-11-11 Thread Bengt Richter
On 10 Nov 2005 10:43:04 -0800, [EMAIL PROTECTED] wrote: >This can be faster, it avoids doing the same things more times: > >from string import maketrans, ascii_lowercase, ascii_uppercase > >def create_words(afile): >stripper = """'[",;<>{}_&?!():[]\.=+-*\t\n\r^%0123456789/""" >mapper = mak

Re: Dynamically Update Class Definitions?

2005-11-11 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Is there a way to loop through all instantiated objects and update > their classes when a source file changes? I know about Michael Hudson's > method > (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164), but > you have to modify all your classes to subcla

changeing users on linux

2005-11-11 Thread darkchild50
how would i go about makeing a program in python that asks for username and password and changes to that user? -- http://mail.python.org/mailman/listinfo/python-list

Re: odd behavior

2005-11-11 Thread Steven D'Aprano
On Fri, 11 Nov 2005 11:34:47 -0800, Greg wrote: > Forgive me, and be kind, as I am just a newby learning this language > out of M.L. Hetland's book. The following behavior of 2.4.1 seems very > strange x = ['aardvark', 'abalone', 'acme', 'add', 'aerate'] x.sort(key=len) x > ['add'

Re: [ x for x in xrange(10) when p(x) ]

2005-11-11 Thread [EMAIL PROTECTED]
Bengt Richter wrote: > Well, it seems you do have to put them in the scopes of different generators, > not just for-clauses, depending on the semantics you want e.g., > > >>> def stop(): raise StopIteration > ... > >>> list( ((x,y) for x in xrange(20) if x<5 or stop() for y in xrange(20) if >

Re: Internal Variables

2005-11-11 Thread Paul Rubin
James Colannino <[EMAIL PROTECTED]> writes: > Basically, I just want to know how from within a script I can get > information about the python interpreter that I'm running. Thanks in > advance. import sys print sys.version -- http://mail.python.org/mailman/listinfo/python-list

Re: Internal Variables

2005-11-11 Thread Steven D'Aprano
On Fri, 11 Nov 2005 10:38:14 -0800, James Colannino wrote: > Hey everyone. I hope I have my terminology right, because I'm not quite > sure what to call them. I was just wondering how I can find information > in internal variables (for example - and I'm just making this up - > __version__ to

Re: [ x for x in xrange(10) when p(x) ]

2005-11-11 Thread Bengt Richter
On Thu, 10 Nov 2005 21:46:37 -0800, [EMAIL PROTECTED] (Alex Martelli) wrote: >[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> > >>> list (x for x in xrange(20) if x<5 or iter([]).next()) >> > [0, 1, 2, 3, 4] >> > >> > Or a bit more readably: >> > >>> def stop(): raise StopIteration >> > ...

Re: list of lambda

2005-11-11 Thread [EMAIL PROTECTED]
Leif K-Brooks wrote: > jena wrote: > > hello, > > when i create list of lambdas: > > l=[lambda:x.upper() for x in ['a','b','c']] > > then l[0]() returns 'C', i think, it should be 'A' > > Fredrik Lundh provided the general solution, but in this specific case, > the simplest solution is: > > l = [x

Re: Hash map with multiple keys per value ?

2005-11-11 Thread snoe
Are you looking for this type of thing? class Test: value = 900 t = Test() d['1'] = t d['2'] = t d['3'] = t d['3'].value = 800 d['1'].value -- http://mail.python.org/mailman/listinfo/python-list

Re: Change directory not successfully done

2005-11-11 Thread Bengt Richter
On Fri, 11 Nov 2005 10:16:02 +0800, Samuel Yin <[EMAIL PROTECTED]> wrote: >Hi, guys, > >This should be a simple problem, but I just can not resolve it. I just >want to use a python script to change my working directory. see my >following code: > ># mycd.py >1) destdir = "" >2) command = "c

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-11 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: ... > Excellent work guys! > > Not only is the divm() bug fixed but it looks like we got a > significant performance increase. Thanks! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-11 Thread Alex Martelli
David Gutierrez <[EMAIL PROTECTED]> wrote: > Include me in your list, please. Uh, what list? If you mean gmpy-commits, you subscribe to it on gmpy.sf.net -- if you mean the general Python list, on www.python.org. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-11 Thread casevh
What processor are you running? I only have Windows running on an old Pentium 3. It is easy for me to build a version that will running on almost any recent processor. I'm willing to try and override the CPU detection and make a processor specific build for you. I won't be able to test it, though.

Re: list of lambda

2005-11-11 Thread Paul Rubin
jena <[EMAIL PROTECTED]> writes: > l=[lambda:x.upper() for x in ['a','b','c']] > then l[0]() returns 'C', i think, it should be 'A' Yeah, this is Python late binding, a standard thing to get confused over. You want: l = [lambda x=x: x.upper() for x in ['a', 'b', 'c']] -- http://mail.python.or

Re: weird problem with os.chmod

2005-11-11 Thread Peter Hansen
Mike Meyer wrote: > Strange that int doesn't recognize the leading 0. But you can use the > second argument to int: > int("0600", 16) > > 1536 You can use it another way too: >>> int('0600', 0) 384 >>> int('0x180', 0) 384 >>> 0600 384 -Peter -- http://mail.python.org/mailman/listinfo/p

Re: tutorial example

2005-11-11 Thread Max Erickson
>>> import math >>> def distance1(x1, y1, x2, y2): dx = x2 - x1 dy = y2 - y1 dsquared = dx**2 + dy**2 result = math.sqrt(dsquared) print result return result >>> def distance2(x1, y1, x2, y2): dx = x2 - x1 dy = y2 - y1 dsquared = dx**2 + dy**2 result = math.s

Re: list of lambda

2005-11-11 Thread Leif K-Brooks
jena wrote: > hello, > when i create list of lambdas: > l=[lambda:x.upper() for x in ['a','b','c']] > then l[0]() returns 'C', i think, it should be 'A' Fredrik Lundh provided the general solution, but in this specific case, the simplest solution is: l = [x.upper for x in ['a', 'b', 'c']] -- htt

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-11 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > <[EMAIL PROTECTED]> wrote: > > > I've created Windows binaries for Python 2.3 and 2.4. It should be > > compatible with PentiumPro or later processors. > > Thanks! I hope to package up a release early next week, and to include > these. > > > Alex I downloaded the binaries a

Re: [ x for x in xrange(10) when p(x) ]

2005-11-11 Thread Bengt Richter
On 10 Nov 2005 18:20:01 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >Bengt Richter wrote: >> If you want to terminate a generator expression after the first sequence of >> elements >> satisfying a condition, and you don't want to use takewhile, I don't know of >> a gotcha >> to preve

Re: directory listing

2005-11-11 Thread Peter Hansen
Shi Mu wrote: > On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >>Shi Mu wrote: >>>def buildList( directory='c:\TEMP' ): >>>dirs = [ ] >>>listing = os.listdir(directory) >>>for x in listing: >>>x = os.path.join(directory, x) >>>print x >>>if os.path.isdir(x

Re: how to start a process and get it's pid?

2005-11-11 Thread Peter Hansen
Fredrik Lundh wrote: > Daniel Crespo wrote: >>os.spawnl(os.P_NOWAIT, "c:/windows/notepad.exe") >>>1944 >> >>I don't get the correct PID. >> >>When I do os.spawnl(os.P_NOWAIT, "c:/windows/notepad.exe") >>I get 168 (for example), while in the tasklist appears notepad.exe with >>the 2476 PID. > >

tutorial example

2005-11-11 Thread john boy
Can somebody tell me why you have to have "return result" in the below program as suggested in a beginner tutorial.  I ran the second listed program below without "return result" and they both give the same value in Python interpreter.  What does "return result" do?   def distance(x1, y1, x2, y2):

Re: weird problem with os.chmod

2005-11-11 Thread Mike Meyer
James Colannino <[EMAIL PROTECTED]> writes: > James Colannino wrote: > >> So then I entered the command print 0600, and saw that the actual >> number being output was 384 (why would it output 384?!) >> >> > > Ok, so further research revealed that 0600 is actually the octal > representation for 384

Re: weird problem with os.chmod

2005-11-11 Thread Gary Herron
James Colannino wrote: >James Colannino wrote: > > > >>So then I entered the command print 0600, and saw that the >>actual number being output was 384 (why would it output 384?!) >> >> >> >> > >Ok, so further research revealed that 0600 is actually the octal >representation for 384 (which

Re: weird problem with os.chmod

2005-11-11 Thread Martin v. Löwis
James Colannino wrote: > Ok, so further research revealed that 0600 is actually the octal > representation for 384 (which makes sense.) So then, I guess my > question would have to be, is there a way for me to make Python aware > that the 0600 I'm passing to int() is octal and not decimal so th

Re: weird problem with os.chmod

2005-11-11 Thread Martin v. Löwis
James Colannino wrote: > I discovered the solution and thought I'd share it with everyone. I > discovered as I googled that Python used to have a function called > atoi() that took the parameter base=X. I decided to see if that worked > with the newer function int() and it did :) I recommend

Re: weird problem with os.chmod

2005-11-11 Thread James Colannino
James Colannino wrote: >Ok, so further research revealed that 0600 is actually the octal >representation for 384 (which makes sense.) So then, I guess my >question would have to be, is there a way for me to make Python aware >that the 0600 I'm passing to int() is octal and not decimal so that

Re: PIL- error message- cannot open libtiff.so.3

2005-11-11 Thread Tuvas
Well, it seems to have resolved the problem. Don't know what was causing it to begin with, but I'll take it... -- http://mail.python.org/mailman/listinfo/python-list

Re: about widget construction kit

2005-11-11 Thread Shi Mu
On 11 Nov 2005 16:06:37 -0800, Martin Miller <[EMAIL PROTECTED]> wrote: > Shi Mu wrote: > > On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > 1. pass in the full path to the executable: > > > > > >cd tkinter3000-1.0-20031212 > > >c:\python23\python setup.py install > > > ... > > >

x, y coordinates in Tkinter canvas

2005-11-11 Thread Shi Mu
got confused by x, y coordinates in Tkinter canvas. from left to right, does X increase? from top to bottom, does y increase? -- http://mail.python.org/mailman/listinfo/python-list

Re: Command-line tool able to take multiple commands at one time?

2005-11-11 Thread Bengt Richter
On Fri, 11 Nov 2005 01:05:56 GMT, Peter A. Schott <[EMAIL PROTECTED]> wrote: >Per subject - I realize I can copy/paste a line at a time into an interactive >session when I'm trying to debug, but was wondering if there is any tool out >there that allows me to copy sections of working Python scripts

Re: weird problem with os.chmod

2005-11-11 Thread James Colannino
James Colannino wrote: >So then I entered the command print 0600, and saw that the >actual number being output was 384 (why would it output 384?!) > > Ok, so further research revealed that 0600 is actually the octal representation for 384 (which makes sense.) So then, I guess my question wo

weird problem with os.chmod

2005-11-11 Thread James Colannino
Ok, so now I have a very interesting problem, this time related to os.chmod. I have the following in a text file: 0600. My script reads that number as a string and converts it to an integer for use with chmod. However, when I do this, instead of the rw-- permissions that I expect, I get

Re: about widget construction kit

2005-11-11 Thread Martin Miller
Shi Mu wrote: > On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > 1. pass in the full path to the executable: > > > >cd tkinter3000-1.0-20031212 > >c:\python23\python setup.py install > > ... > > > still confused by th first way you mentioned. If I cd > tkinter3000-1.0-20031212, i w

Re: Recommendation please: forming an XML toolkit

2005-11-11 Thread jmdeschamps
I guess you're right... I think its just cold feet from the possibility of getting involved and discovering specific gotchas later. What I'm hearing you tell me is *go and play it*. Thanks for replying... -- http://mail.python.org/mailman/listinfo/python-list

Re: Needed class whose instances are many test cases

2005-11-11 Thread Ben Finney
Roy Smith <[EMAIL PROTECTED]> wrote: > Ben Finney <[EMAIL PROTECTED]> wrote: > > Test cases should each run individually, from a known state, and > > not depend on any other tests. You can define a fixture for > > several tests in the unittest.TestCase methods setUp() and > > tearDown(), to establi

Re: x, y coordinates in Tkinter canvas

2005-11-11 Thread jepler
Let's find out! This program creates a series of rectangles, with the color going from black to nearly white. White corresponds to higher x and y coordinate values. So the answer to your question can be seen in the output of the program. import Tkinter c = Tkinter.Canvas(width=220, height=220)

Re: list of lambda

2005-11-11 Thread Fredrik Lundh
"jena" <[EMAIL PROTECTED]> wrote: > when i create list of lambdas: > l=[lambda:x.upper() for x in ['a','b','c']] > then l[0]() returns 'C', i think, it should be 'A' the "x" variable contains "c" when you leave the loop: >>> l=[lambda:x.upper() for x in ['a','b','c']] >>> x 'c' so x.upper() wil

Ann.: Python wrapper for Tktreectrl

2005-11-11 Thread klappnase
I wrote a Tkinter wrapper for the tktreectrl widget (). Tktreectrl is an advanced tool that lets you set up things like sortable multi column listboxes and tree browsers. The python module comes with a reference manual and a (very basic) demo script. The url is

Re: os.chown()

2005-11-11 Thread James Colannino
Mike Meyer wrote: >You want pwd.getpwnam and grp.getgrnam. > > Thanks. Hope my newbie questions haven't gotten on anybody's nerves yet ;) James -- My blog: http://www.crazydrclaw.com/ My homepage: http://james.colannino.org/ "A well regulated militia being necessary to the security of a fr

Re: os.chown()

2005-11-11 Thread Mike Meyer
James Colannino <[EMAIL PROTECTED]> writes: > Hey everyone. I tried to use os.chown() in the following manner: > > os.chown('filename', 'username', 'groupname') > > I got an error, and when I googled for this function I realized that I > must pass the numerical uid and gid. My question is, is th

Re: Command-line tool able to take multiple commands at one time?

2005-11-11 Thread Devan L
Peter A. Schott wrote: > OK - I justed tested and may be doing something wrong, but it didn't work > when I > just tried it. > > I have something like this: > > X = "Value1" > Y = "Value2" > Z = "Value3" > > etc at the top of my script. When I copy/paste those three lines all at once > into IDLE'

list of lambda

2005-11-11 Thread jena
hello, when i create list of lambdas: l=[lambda:x.upper() for x in ['a','b','c']] then l[0]() returns 'C', i think, it should be 'A' my workaround is to define helper class with __call__ method: class X: def __init__(self,s): self.s=s def __call__(self): return self.s.upper() l=[X(x) for x

Re: directory listing

2005-11-11 Thread Fredrik Lundh
"Shi Mu" wrote: > print buildList() gets lots of stuffs from my temp directory(there do > exist lots of files). > But why "print x' has nothing? C:\>more script.py import os def buildList( directory='c:\TEMP' ): dirs = [ ] listing = os.listdir(directory) for x in listing: x =

os.chown()

2005-11-11 Thread James Colannino
Hey everyone. I tried to use os.chown() in the following manner: os.chown('filename', 'username', 'groupname') I got an error, and when I googled for this function I realized that I must pass the numerical uid and gid. My question is, is there a way for me to change ownership based on the nam

Re: PIL- error message- cannot open libtiff.so.3

2005-11-11 Thread Fredrik Lundh
Erik Max Francis wrote: > Install libtiff. note that PIL doesn't use libtiff, so that only addresses the symtoms. (which might be good enough, of course) -- http://mail.python.org/mailman/listinfo/python-list

Re: directory listing

2005-11-11 Thread Shi Mu
On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > "Shi Mu" wrote: > > > but i am curious why the line of "print x" does not show > > anything. > > because your c:\temp directory is empty ? > > print buildList() gets lots of stuffs from my temp directory(there do exist lots of files). But why

Re: odd behavior

2005-11-11 Thread Lee Harr
On 2005-11-11, Kristian Zoerhoff <[EMAIL PROTECTED]> wrote: > On 11 Nov 2005 11:34:47 -0800, Greg <[EMAIL PROTECTED]> wrote: >> Forgive me, and be kind, as I am just a newby learning this language >> out of M.L. Hetland's book. The following behavior of 2.4.1 seems very >> strange >> >>> x = ['aar

Re: directory listing

2005-11-11 Thread Fredrik Lundh
"Shi Mu" wrote: > but i am curious why the line of "print x" does not show > anything. because your c:\temp directory is empty ? -- http://mail.python.org/mailman/listinfo/python-list

Re: about widget construction kit

2005-11-11 Thread Shi Mu
On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Shi Mu wrote: > > > > > I tried to install WCK(Widget Construction Kit (WCK)): > > > > > > > > C:\Python23>python tkinter3000-1.0-20031212\setup.py install > > > > Traceback (most recent call last): > > > > File "tkinter3000-1.0-20031212\set

Re: Curses & Keypress

2005-11-11 Thread Lee Harr
On 2005-11-11, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Now that I have gotoxy() down for moving the cursor around, I want that > to be a result of keypresses (namely from the numpad -- 7 = NorthWest, > 8 = North, 9 = NE, etc...). I have little clue how to do this. After > searching google,

Re: directory listing

2005-11-11 Thread Shi Mu
On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Shi Mu wrote: > > > I tried this and no error reported but nothing appear on the console, why? > > > > import os > > > > def buildList( directory='c:\TEMP' ): > > dirs = [ ] > > listing = os.listdir(directory) > > for x in listing:

Re: What do you use as symbols for Python?

2005-11-11 Thread Björn Lindström
Gary Herron <[EMAIL PROTECTED]> writes: > Another similar approach that keeps those values together in a single > namespace is this (my favorite): > > class State: > OPENED, CLOSED, ERROR = range(3) > > Then you can refer to the values as >State.OPENED >State.CLOSED >State.ERROR

Re: Recommendation please: forming an XML toolkit

2005-11-11 Thread uche . ogbuji
*SNIP Long list of possible criteria for chooseing an XML library* Even with all your personal considerations, there is no one "correct" answer for you. I can think of four or five packages that would meet all your criteria. You said something quite apt: "This question is a bit like the ones pe

Re: directory listing

2005-11-11 Thread Fredrik Lundh
Shi Mu wrote: > I tried this and no error reported but nothing appear on the console, why? > > import os > > def buildList( directory='c:\TEMP' ): > dirs = [ ] > listing = os.listdir(directory) > for x in listing: > x = os.path.join(directory, x) > print x > if

Re: about widget construction kit

2005-11-11 Thread Fredrik Lundh
Shi Mu wrote: > > > I tried to install WCK(Widget Construction Kit (WCK)): > > > > > > C:\Python23>python tkinter3000-1.0-20031212\setup.py install > > > Traceback (most recent call last): > > > File "tkinter3000-1.0-20031212\setup.py", line 23, in ? > > > WCK_VERSION = setuplib.find_version

Re: What do you use as symbols for Python ?

2005-11-11 Thread gsteff
I've seen the following style in some code (the formencode library comes to mind): opened = object() closed = object() error = object() Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: 3-dimensional plot in Python?

2005-11-11 Thread Lee Harr
On 2005-11-11, questions? <[EMAIL PROTECTED]> wrote: > I want to make a 3d plot. x is a vector(discrete), y is also a > vector(discrete), for each pairwise x,y I have a value z(x,y)(it is not > a function, just discrete values for each pair of x,y) > > I want to show them on a two dimensional plot

Re: directory listing

2005-11-11 Thread Shi Mu
On 11 Nov 2005 22:00:04 GMT, Michael Konrad <[EMAIL PROTECTED]> wrote: > Richard Townsend <[EMAIL PROTECTED]> wrote: > > > On 11 Nov 2005 21:20:33 GMT, SU News Server wrote: > > > > Try passing the full pathname of each item to os.path.isdir() > > > > You can create the pathname using os.path.join(

Re: directory listing

2005-11-11 Thread Fredrik Lundh
Michael Konrad wrote: > > for x in listing: > > print x > > if os.path.isdir(x): > > dirs.append(x) > > > > Did that and I was just getting a bunch of [ ]. if you printed "x" (the filename), that doesn't sound very likely. maybe you printed some other variable? (l

Re: directory listing

2005-11-11 Thread Richard Townsend
On 11 Nov 2005 22:00:04 GMT, Michael Konrad wrote: > Richard Townsend <[EMAIL PROTECTED]> wrote: > >> On 11 Nov 2005 21:20:33 GMT, SU News Server wrote: >> >> Try passing the full pathname of each item to os.path.isdir() >> >> You can create the pathname using os.path.join(directory, x) >> >>

Re: directory listing

2005-11-11 Thread Michael Konrad
Richard Townsend <[EMAIL PROTECTED]> wrote: > On 11 Nov 2005 21:20:33 GMT, SU News Server wrote: > > Try passing the full pathname of each item to os.path.isdir() > > You can create the pathname using os.path.join(directory, x) > > > I wonder if I can join ./, so I don't have the full path

Re: directory listing

2005-11-11 Thread Michael Konrad
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > "SU News Server" <[EMAIL PROTECTED]> wrote: > >> I've struggled with this for quite a while and I'm am just not sure >> what is going on. I have the following code >> import os >> >> def buildList( directory='/Users/mkonrad' ) >> >> dirs = [ ] >> >> l

Re: about widget construction kit

2005-11-11 Thread Shi Mu
On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Shi Mu wrote: > > > I tried to install WCK(Widget Construction Kit (WCK)): > > > > C:\Python23>python tkinter3000-1.0-20031212\setup.py install > > Traceback (most recent call last): > > File "tkinter3000-1.0-20031212\setup.py", line 23, in

Re: about widget construction kit

2005-11-11 Thread Fredrik Lundh
Shi Mu wrote: > I tried to install WCK(Widget Construction Kit (WCK)): > > C:\Python23>python tkinter3000-1.0-20031212\setup.py install > Traceback (most recent call last): > File "tkinter3000-1.0-20031212\setup.py", line 23, in ? > WCK_VERSION = setuplib.find_version("WCK/__init__.py") >

Re: directory listing

2005-11-11 Thread Richard Townsend
On 11 Nov 2005 21:20:33 GMT, SU News Server wrote: Try passing the full pathname of each item to os.path.isdir() You can create the pathname using os.path.join(directory, x) -- Richard -- http://mail.python.org/mailman/listinfo/python-list

Re: output buffering

2005-11-11 Thread JD
On 2005-11-11, Larry Bates <[EMAIL PROTECTED]> wrote: > This is something I wrote that might help. > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299207 > The solutions become better and better. Thanks. > -Larry Bates > > JD wrote: >> Hello, >> >> When reading a large datafile, I wa

Re: directory listing

2005-11-11 Thread Fredrik Lundh
"SU News Server" <[EMAIL PROTECTED]> wrote: > I've struggled with this for quite a while and I'm am just not sure > what is going on. I have the following code > import os > > def buildList( directory='/Users/mkonrad' ) > > dirs = [ ] > > listing = os.listdir(directory) > > for x in listing: >

about widget construction kit

2005-11-11 Thread Shi Mu
I tried to install WCK(Widget Construction Kit (WCK)): C:\Python23>python tkinter3000-1.0-20031212\setup.py install Traceback (most recent call last): File "tkinter3000-1.0-20031212\setup.py", line 23, in ? WCK_VERSION = setuplib.find_version("WCK/__init__.py") File "C:\wget2\tkinter3000-1

directory listing

2005-11-11 Thread SU News Server
I've struggled with this for quite a while and I'm am just not sure what is going on. I have the following code import os def buildList( directory='/Users/mkonrad' ) dirs = [ ] listing = os.listdir(directory) for x in listing: if os.path.isdir(x):

Re: Command-line tool able to take multiple commands at one time?

2005-11-11 Thread Peter A.Schott
OK - I justed tested and may be doing something wrong, but it didn't work when I just tried it. I have something like this: X = "Value1" Y = "Value2" Z = "Value3" etc at the top of my script. When I copy/paste those three lines all at once into IDLE's interactive window, X is defined, Y and Z a

Re: Command-line tool able to take multiple commands at one time?

2005-11-11 Thread Peter A.Schott
I'll give it a try. I've been using PythonWin and SPE recently and hadn't really messed with IDLE too much as I liked the somewhat more advanced features of the other IDEs. I'll check it out again. Also thanks to all for the IP hints - I may check those out as well. -Pete "Devan L" <[EMAIL PRO

Re: Python music interfaces

2005-11-11 Thread groupstudy2001
Lonnie Princehouse wrote: > Are you talking about audio files (wav, mp3) or MIDI? Strictly discrete notes or chords. I honestly don't know how the files are made up but I guess MIDI would be more the thing. Can you recommend a package for reading them (as arrays, perhaps)? The simpler the better

Re: PIL- error message- cannot open libtiff.so.3

2005-11-11 Thread Tuvas
Oddly enough, that seems to have solved the problem. Duh. Take the simple solution first. Thanks for the wake up call! -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL- error message- cannot open libtiff.so.3

2005-11-11 Thread Fredrik Lundh
Tuvas wrote: > I got it from the PIL website, version 1.1.5. I guess it's possible > that there's another library Image on the computer that it could be > confusing? I'm looking for new things. Thanks! afaik, there are no unix binaries on the PIL website. did you build it yourself, from source c

Re: PIL- error message- cannot open libtiff.so.3

2005-11-11 Thread Erik Max Francis
Tuvas wrote: > Okay, so I've been getting this error message when trying to use PIL to > open a JPEG, that there isn't a library by the name of libtiff.so.3 . > I've been searching the documentation, there isn't any reference to > this library. Also, I don't know why it's doing this as I'm trying

Re: Python Countdown

2005-11-11 Thread Simon Brunning
On 11/11/05, john boy <[EMAIL PROTECTED]> wrote: > I have adjusted the program to: > > import sys. > sys. getrecursionlimit() > sys.setrecursionlimit(2000) > def countdown (n): >if n ==0: >print "blastoff" > else: > print n > countdown (n-1) > countdown

Re: Python Countdown

2005-11-11 Thread Simon Brunning
On 11/11/05, john boy <[EMAIL PROTECTED]> wrote: > I am running the following program from the example in "how to think like a > computer scientist" > > def countdown(n): > if n ==0: >print "Blastoff!" > else: > print n > countdown (n-1) > > countdown (10

  1   2   3   >