state of SOAP and python?

2006-08-09 Thread Mark Harrison
So I'm investigating doing some SOAP work... Any concensus on what the best python libraries are for doing this? Too bad, xmlrpc is choking on our long longs. :-( Many TIA, Mark -- Mark Harrison Pixar Animation Studios -- http://mail.python.org/mailman/listinfo/python-list

Re: loop until keypress (Windows XP)

2006-08-09 Thread placid
Gabriel Genellina wrote: > At Thursday 10/8/2006 02:19, placid wrote: > > >chr = sys.stdin.read(1) > >while chr != "q": > > """ keep printing text """ > > chr = sys.stdin.read(1) > > > >but again this blocks too. > > > >is there a way to do this, wait for user input but dont block? I could

Re: loop until keypress (Windows XP)

2006-08-09 Thread Andy Terrel
If you did want a linux version you could just make people send a KeyboardInterupt. try: print "Press ^C to stop" loop except KeyboardInterrupt: some stop action or just pass -- http://mail.python.org/mailman/listinfo/python-list

Re: using python at the bash shell?

2006-08-09 Thread Tim Roberts
John Salerno <[EMAIL PROTECTED]> wrote: > >Can you use IPython to do normal bash things, like installing, etc.? Most scripts on Linux have a "hash-bang" line as their first line: #! /bin/sh When you execute that script, the system knows that it has to load sh or bash to process it, regardless

Re: loop until keypress (Windows XP)

2006-08-09 Thread Gabriel Genellina
At Thursday 10/8/2006 02:19, placid wrote: chr = sys.stdin.read(1) while chr != "q": """ keep printing text """ chr = sys.stdin.read(1) but again this blocks too. is there a way to do this, wait for user input but dont block? I could use a thread that just does the previous code block

Re: loop until keypress (Windows XP)

2006-08-09 Thread Farshid Lashkari
placid wrote: > is there a way to do this, wait for user input but dont block? Hi, The msvcrt module should do what you want. Here is a sample: import msvcrt chr = 0 while chr != 'q': """ keep printing text """ if msvcrt.kbhit(): chr = msvcrt.getch() Keep in mind that this

Re: Regd:Video Converter Programming

2006-08-09 Thread Ch3ru5
HI, Thanks all for replies . I am sorry for a confusion of the question . But what i wanted to know is in general in any programming language , how you go about writing a video converter . The basic flow of code . that's it . I will look into the resources in a particular language of my choice l

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Stephan Kuhagen
Erik Max Francis wrote: > The problem is that there are endless ways to do that, and figuring out > all the cases makes `file` an sh interpreter, not the magic number > detector it's supposed to be. It makes it into a pattern-matcher, not an interpreter. But that it is already. But right, there

loop until keypress (Windows XP)

2006-08-09 Thread placid
Hi all, Im using the cmd module and i have command that loops and keeps on printing text, what i want to be able to do is loop until the user presses a particular key, say Q/q ? I tried the following code; line = raw_input ("press q to abort") while line[0] != "q": """ keep printing text ""

Re: do people really complain about significant whitespace?

2006-08-09 Thread Tim Roberts
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > I forget what COBOL used, but it had a few fields of its own. Not in fixed columns. Surprisingly, layout in COBOL was more closely related to Python, in that indentation was significant, but the number of characters per indent was up to the p

Re: os.path.normpath

2006-08-09 Thread grahamd
[EMAIL PROTECTED] wrote: > I am using a windows box and passing a string like "../foo/../foo2" to > normpath which then returns "..\\foo2". But if this string is going > into a webpage link it should really be "../foo". > > Is there any way to tell os.path.normpath to act like we are an a unix > s

Re: Two Classes In Two Files

2006-08-09 Thread Gabriel Genellina
At Wednesday 9/8/2006 16:24, [EMAIL PROTECTED] wrote: I just started working with Python and ran into an annoyance. Is there a way to avoid having to use the "from xxx import yyy" syntax from files in the same directory? I'm sure it's been asked a million times, but I can't seem to find the answ

Re: Nested function scope problem

2006-08-09 Thread Gabriel Genellina
At Wednesday 9/8/2006 16:15, [EMAIL PROTECTED] wrote: I agree with the previous comments that this approach is "bad form". But if you absolutely *must* modify an enclosing function's variables with an inner function, all you need to do is remember that a Python function is an object too, so it c

Re: do people really complain about significant whitespace?

2006-08-09 Thread Gerhard Fiedler
On 2006-08-09 11:10:20, Stephen Kellett wrote: > If you mean, should code be well written, thought about, well formatted, > sensible class/variable names, redesigned if you find a better way, sure > no problem with that. I mean the code should be written so that as few as possible comments are

Re: os.path.normpath

2006-08-09 Thread Gabriel Genellina
At Wednesday 9/8/2006 15:45, [EMAIL PROTECTED] wrote: I am using a windows box and passing a string like "../foo/../foo2" to normpath which then returns "..\\foo2". But if this string is going into a webpage link it should really be "../foo". You could just .replace('\\','/') on the resulting

Re: Open file handles?

2006-08-09 Thread danielx
Is there an equivalent in windows? Jon wrote: > Perhaps using os you could work with lsof > [http://www.linuxcommand.org/man_pages/lsof8.html] > > Jon > > Thomas Bartkus wrote: > > This may be more of a Linux question, but I'm doing this from Python. . > > > > How can I know if anything (I don

Re: why does getpass() show the input?

2006-08-09 Thread John Machin
John Machin wrote: > > If it's a question, and you'd like a helpful answer, try telling us at > least [snip] plus (6) what conclusions you have after reading /Lib/getpass.py -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy image rendering?

2006-08-09 Thread [EMAIL PROTECTED]
I think that you've put me on the right track, but my eventual goal is to be able to put the pictures on the screen with a full-screen interface. Not in a visible window, with just the picture and then a black backdrop for it. [EMAIL PROTECTED] wrote: > >> If you are using PIL you could use im.sh

Re: Easy image rendering?

2006-08-09 Thread skip
>> If you are using PIL you could use im.show(); but all that does is >> saving the image data to a file and opening that file in an external >> application (xv on UNIX). At least you don't have to do it yourself. jay> No good. No external applications. What else is there? Wors

Re: Easy image rendering?

2006-08-09 Thread [EMAIL PROTECTED]
No good. No external applications. What else is there? Worst case scenario, what's the easiest way to do GUI? Pontus Ekberg wrote: > On Wed, 09 Aug 2006 16:27:50 -0700, [EMAIL PROTECTED] wrote: > > > Can someone tell me what's the absolute easiest way of putting an image > > on to the screen in

Re: Easy image rendering?

2006-08-09 Thread skip
import PIL.Image img = PIL.Image.open(open("someimage.png", "rb")) img.show() No need for the extra open. Sorry... Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy image rendering?

2006-08-09 Thread skip
jay> Can someone tell me what's the absolute easiest way of putting an jay> image on to the screen in Python without just opening it up in an jay> application? What's the simplest way to just put something up on jay> the screen? Maybe something like this: import PIL.Image

Re: Easy image rendering?

2006-08-09 Thread Pontus Ekberg
On Wed, 09 Aug 2006 16:27:50 -0700, [EMAIL PROTECTED] wrote: > Can someone tell me what's the absolute easiest way of putting an image > on to the screen in Python without just opening it up in an > application? What's the simplest way to just put something up on the > screen? If you are using P

Re: using python with tar files and compressed files

2006-08-09 Thread John Machin
[EMAIL PROTECTED] wrote: > This syntax works on other bzipped tar files. But it's not unheard of > that large tarballs will get corrupted from a download mirror. Use a > download manager and try redownloading the file. Usually a mirror will > include an md5sum text file so that you can compare the

Re: do people really complain about significant whitespace?

2006-08-09 Thread Carl Banks
Michiel Sikma wrote: > Op 9-aug-2006, om 16:48 heeft Carl Banks het volgende geschreven: > > > Even if this were legal code (it isn't), it's still more transparent > > than some of the C code I've seen. > > > > Carl Banks > > Still kind of too bad that means there won't ever be an International > O

Re: Class data being zapped by method

2006-08-09 Thread John Machin
Kevin M wrote: > Good news. I've fixed it up and all seems to be well. > > Thanks, all. I've learned a lot from this -:) Kindly share the learning by feeding back: (1) What the original problem ("class data being zapped by method") really was. (2) What was the cause of the drama with pyc files.

Re: knowing when file is flushed to disk

2006-08-09 Thread Neil Hodgson
John Pote: > Is there some way from my Python script to know when the data is actually on > the disk. BTW server OS is Linux. Presumably calling flush() and close() on > the output file will initiate the disk write, but do they wait for the > actual disk write or immediately return leaving the

Re: do people really complain about significant whitespace?

2006-08-09 Thread Ed Jensen
infidel <[EMAIL PROTECTED]> wrote: > Where are they-who-hate-us-for-our-whitespace? Are "they" really that > stupid/petty? Are "they" really out there at all? "They" almost sound > like a mythical caste of tasteless heathens that "we" have invented. > It just sounds like so much trivial nitpicke

Re: why does getpass() show the input?

2006-08-09 Thread John Machin
John Salerno wrote: > I'm guessing this might have something to do with my particular system? Is that meant to be a statement or a question? If it's a question, and you'd like a helpful answer, try telling us at least (1) what platform you are running on, (2) did you enter that at the usual OS c

Re: serial ports, threads and windows

2006-08-09 Thread Tom Brown
On Wednesday 02 August 2006 16:02, Tom Brown wrote: > I've written a python app that r/w eight serial ports to control eight > devices using eight threads. This all works very nicely in Linux. I even > put a GUI on it using PyQt4. Still works nicely. > > Then I put the app on on a virtual Windows m

Re: technique to enter text using a mobile phone keypad (T9 dictionary-based disambiguation)

2006-08-09 Thread John Machin
[EMAIL PROTECTED] wrote: > John Machin: > > 2. All responses so far seem to have missed a major point in the > > research paper quoted by the OP: each word has a *frequency* associated > > with it. When there are multiple choices (e.g. "43" -> ["he", "if", > > "id", ...]), the user is presented wi

imputil + pyparsing -> Python-based DSL

2006-08-09 Thread Paul McGuire
Wilson Fowlie sent me an e-mail describing James Theile's presentation at the Vancouver Python Workshop, using imputil to create simple DSL's. I thought that by creating a DSL grammar and making it part of an imputil hook, you could generate Python source code to implement the corresponding classe

Re: technique to enter text using a mobile phone keypad (T9 dictionary-based disambiguation)

2006-08-09 Thread bearophileHUGS
John Machin: > 2. All responses so far seem to have missed a major point in the > research paper quoted by the OP: each word has a *frequency* associated > with it. When there are multiple choices (e.g. "43" -> ["he", "if", > "id", ...]), the user is presented with the choices in descending > frequ

Easy image rendering?

2006-08-09 Thread [EMAIL PROTECTED]
Can someone tell me what's the absolute easiest way of putting an image on to the screen in Python without just opening it up in an application? What's the simplest way to just put something up on the screen? -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the cleanest way to compare 2 dictionary?

2006-08-09 Thread John Machin
John Henry wrote: > Hi list, > > I am sure there are many ways of doing comparision but I like to see > what you would do if you have 2 dictionary sets (containing lots of > data - like 2 keys and each key contains a dozen or so of records) > and you want to build a list of differences about t

Image concatenation in PIL

2006-08-09 Thread skip
Looking through the PIL docs I didn't see any obvious (one-line) way of concatenating two images. Given im1 and im2 which I wish to concatenate left-to-right, is this the simplest I can do? def imconcat(im1, im2): # concatenate im1 and im2 left-to-right h1, w1 = im1.size

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread olsongt
Erik Max Francis wrote: > [EMAIL PROTECTED] wrote: > > > Basically, someone could inject an arbirtrary script called 'python' > > into your path that does whatever (rm -fr /) under your user context > > when you run the script. But the same thing would happen if you run > > 'python test.py' inste

Re: timeout calling local sendmail

2006-08-09 Thread Tim Williams
On 9 Aug 2006 08:22:03 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > that's > "timeout calling local sendmail" > not > "timeout calling local se" > > > [EMAIL PROTECTED] wrote: > > (Environment: RedHat Linux recent, Python 2.3.5) > > > > We have a batch processing script that on occasion n

Re: Regd:Video Converter Programming

2006-08-09 Thread placid
Grant Edwards wrote: > On 2006-08-09, placid <[EMAIL PROTECTED]> wrote: > > >> I want to write an avi to flv converter in php but i am a complete > >> newbie to it. > > > via a Google search for "python video convert" i found the following > > > > http://pymedia.org/ > > Except he wants to write i

Re: technique to enter text using a mobile phone keypad (T9 dictionary-based disambiguation)

2006-08-09 Thread John Machin
[EMAIL PROTECTED] wrote: > I've tested that sorting just the strings instead of the tuples (and > removing the stripping) reduces the running time enough: > > def __init__(self): > numbers = '222333444555666888' > conv = string.maketrans(string.lowercase, numbers) >

Re: converting a nested try/except statement into try/except/else

2006-08-09 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : > John Salerno a écrit : > (snip) or of course the dead simple: try: if int(text) <= 0: raise ValueError except ValueError: self.error_message() return False else: return True BTW, you really should have a

Re: Two Classes In Two Files

2006-08-09 Thread Pedro Werneck
On 9 Aug 2006 12:35:48 -0700 "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > It's just the way it is. Why worry about it? > > Wasn't so much a worry, just trying to figure out how to think the > python way. Seems like you're thinking the Java way... if you don't want to do it, put both cla

Re: String.digits help!!!

2006-08-09 Thread Ron Adam
[EMAIL PROTECTED] wrote: > Simon Forman: > >> accessing it from a >> module (perhaps math.. math.infinity, math.epsilon, etc., just like >> math.pi and math.e.) > > It too looks acceptable. > > >> I look forward to hearing your thoughts an the subject. > > Thank you, but I am not expert enoug

Re: __contains__ vs. __getitem__

2006-08-09 Thread Pedro Werneck
On Wed, 09 Aug 2006 16:51:23 GMT "David Isaac" <[EMAIL PROTECTED]> wrote: > Looking forward: > Can I count on this independence of __getitem__ and __contains__? > I would like to understand whether it will be safe to count on this > behavior. With the builtin 'dict' implementation, dict.__contai

Re: What's the cleanest way to compare 2 dictionary?

2006-08-09 Thread John Henry
John Henry wrote: > Paddy wrote: > > John Henry wrote: > > > Hi list, > > > > > > I am sure there are many ways of doing comparision but I like to see > > > what you would do if you have 2 dictionary sets (containing lots of > > > data - like 2 keys and each key contains a dozen or so of recor

Re: What's the cleanest way to compare 2 dictionary?

2006-08-09 Thread John Henry
Paddy wrote: > John Henry wrote: > > Hi list, > > > > I am sure there are many ways of doing comparision but I like to see > > what you would do if you have 2 dictionary sets (containing lots of > > data - like 2 keys and each key contains a dozen or so of records) > > and you want to build a

RE: Question about using python as a scripting language

2006-08-09 Thread Delaney, Timothy (Tim)
Carl Banks wrote: > Delaney, Timothy (Tim) wrote: >> Steve Lianoglou wrote: >> >>> So, for instance, you can write: >>> my_list = eval('[1,2,3,4]') >> >> This is just asking for trouble. >> >> my_list = eval('import shutil; shutil.rmtree('/')') > > Fortunately, that won't work because eval exp

Re: The decentralized nature of the Python community is driving me crazy

2006-08-09 Thread Ravi Teja
> But I must say the one thing I miss about Perl is my ability to stay on > top of all the latest modules and apps in one place: CPAN. With Python, > code is EVERYWHERE - people's local boxes, sourceforge, freshmeat, > codezoo, parnassus, etc, etc. Python CheeseShop is equivalent to CPAN http://ww

RE: Newbie - How to iterate list or scalar ?

2006-08-09 Thread Delaney, Timothy (Tim)
Bruno Desthuilliers wrote: > What I wonder here is why __iter__ has been added to lists and tuples > but not to strings (not that I'm complaining, it's just curiousity...) Because someone got around to doing it. Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

[OT] Exciting Job Opporunity : Python and Configuration Management

2006-08-09 Thread Kartic
Hello, We are looking for an experienced configuration management engineer for a client based in Cincinnati, Ohio. Below is a summary of the job. Kindly email resumes to email address shown below. Thank you, --Kartic Job Title: Configuration Management Engineer Job Reference: OHCM Job descri

Re: Eval (was Re: Question about using python as a scripting language)

2006-08-09 Thread Simon Forman
Chris Lambacher wrote: > On Wed, Aug 09, 2006 at 11:51:19AM -0400, Brendon Towle wrote: > >On 9 Aug 2006, at 11:04 AM, Chris Lambacher wrote: > > > > How is your data stored? (site was not loading for me). > > > >In the original source HTML, it's like this (I've deleted all but the > >

The decentralized nature of the Python community is driving me crazy

2006-08-09 Thread metaperl . bzr
hi everyone, I am the first of what may be hundreds of refugees from the Perl community. Not only is Python a more productive language, with many more nice apps, but the people are friendly as well... waaay more friendly than the Perl crowd. But I must say the one thing I miss about Perl is my ab

Re: knowing when file is flushed to disk

2006-08-09 Thread [EMAIL PROTECTED]
John Pote wrote: > Is there some way from my Python script to know when the data is actually on > the disk. BTW server OS is Linux. Presumably calling flush() and close() on > the output file will initiate the disk write, but do they wait for the > actual disk write or immediately return leaving th

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > Basically, someone could inject an arbirtrary script called 'python' > into your path that does whatever (rm -fr /) under your user context > when you run the script. But the same thing would happen if you run > 'python test.py' instead of '/usr/local/bin/python test.py

Re: Python share CPU time?

2006-08-09 Thread [EMAIL PROTECTED]
Yannick wrote: > Hi, > > I would like to program a small game in Python, kind of like robocode > (http://robocode.sourceforge.net/). > Problem is that I would have to share the CPU between all the robots, > and thus allocate a time period to each robot. However I couldn't find > any way to start a

Re: technique to enter text using a mobile phone keypad (T9 dictionary-based disambiguation)

2006-08-09 Thread bearophileHUGS
I've tested that sorting just the strings instead of the tuples (and removing the stripping) reduces the running time enough: def __init__(self): numbers = '222333444555666888' conv = string.maketrans(string.lowercase, numbers) lines = file("/usr/share/dict/word

why does getpass() show the input?

2006-08-09 Thread John Salerno
I'm guessing this might have something to do with my particular system? >>> getpass.getpass() Warning: Problem with getpass. Passwords may be echoed. Password: hello 'hello' -- http://mail.python.org/mailman/listinfo/python-list

Re: Dallas One wire tempreture measurement.

2006-08-09 Thread Gregor Horvath
[EMAIL PROTECTED] schrieb: > a previous thread > > http://mail.python.org/pipermail/python-list/2002-June/107616.html > > discussed this issue, and Dave Moor kindly pointed to his solution. > However this is no longer a current link, does anyone know if there is > a currently available solution?

Re: technique to enter text using a mobile phone keypad (T9 dictionary-based disambiguation)

2006-08-09 Thread bearophileHUGS
Note that this is essentially a data-compression problem, so the most accurate solution is probably to use an instrumeted PAQ compressor in a certain smart way, but you have to work a lot to implement this solution, and maybe this problem doesn't deserve all this work. Bye, bearophile -- http://

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread olsongt
Aahz wrote: > In article <[EMAIL PROTECTED]>, > John Salerno <[EMAIL PROTECTED]> wrote: > > > >I understand the difference, but I'm just curious if anyone has any > >strong feelings toward using one over the other? I was reading that a > >disadvantage to the more general usage (i.e. env) is that

Re: Announcing Switch, the CSS Preprocessor!

2006-08-09 Thread poorgeek
The zip file contains HTML docs but the menus are broken so that you can't navigate them if you just want browse them from the local filesystem. fuzzylollipop wrote: > Dave wrote: > > Powered by Mod_Python, Switch CSS is a full featured, production ready > > > > > The sourceforge project link foll

Re: converting a nested try/except statement into try/except/else

2006-08-09 Thread Simon Forman
John Salerno wrote: > I'm starting out with this: > > try: > if int(text) > 0: > return True > else: > self.error_message() > return False > except ValueError: > self.error_message() > return False > > I rewrote it as this: > > try: > int(text) >

Re: converting a nested try/except statement into try/except/else

2006-08-09 Thread Bruno Desthuilliers
John Salerno a écrit : > I'm starting out with this: > > try: > if int(text) > 0: > return True > else: > self.error_message() > return False > except ValueError: > self.error_message() > return False > > I rewrote it as this: > > try: > int(text) > ex

Re: technique to enter text using a mobile phone keypad (T9 dictionary-based disambiguation)

2006-08-09 Thread bearophileHUGS
Justin Azoff: > It takes a second or two to read the list of words in, Nice solution. If you want to speed up the initialization phase you may use something like this (it requires a bit more memory, because lines contains all the words). Note that the words and numbers have the same sorting order

Re: Announcing Switch, the CSS Preprocessor!

2006-08-09 Thread fuzzylollipop
Dave wrote: > Powered by Mod_Python, Switch CSS is a full featured, production ready > > The sourceforge project link follows. We could really use some tire > kickers... This group was invaluable in the early development process, > so we're announcing it officially here, and on mod_python first.

MergeSort

2006-08-09 Thread ben81
Hi, the following code is adopted PseudoCode from Introduction to Algorithms (Cormen et al). For some reason it can't get it to work. I always get a index of out bounds exception or some weird result. Secondly I'd like to know how to write this more pythonic. TIA. import random import listutil im

Re: Announcing Switch, the CSS Preprocessor!

2006-08-09 Thread Dave
It's not tied deeply to mod_python. The processor works like this: You create an "sss" file, using Switch specific features. Then, you place the file under Apache/mod_python OR you can use the command-line Switch tool to process the SSS file and output a CSS file. In this way, it works very simil

Re: technique to enter text using a mobile phone keypad (T9 dictionary-based disambiguation)

2006-08-09 Thread Petr Jakes
Thanks a lot. It works flawlessly and I have learned few new Python "tricks" as well. Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list

Re: Two Classes In Two Files

2006-08-09 Thread [EMAIL PROTECTED]
> It's just the way it is. Why worry about it? Wasn't so much a worry, just trying to figure out how to think the python way. Max M wrote: > [EMAIL PROTECTED] wrote: > > I just started working with Python and ran into an annoyance. Is there > > a way to avoid having to use the "from xxx import yy

Re: Two Classes In Two Files

2006-08-09 Thread bearophileHUGS
[EMAIL PROTECTED]: > Is there > a way to avoid having to use the "from xxx import yyy" syntax from > files in the same directory? You can just use: import xxx and then: class Two(xxx.One): ... If you don't want to use the import line, you have to put the two classes into the same module. By

Re: Two Classes In Two Files

2006-08-09 Thread Max M
[EMAIL PROTECTED] wrote: > I just started working with Python and ran into an annoyance. Is there > a way to avoid having to use the "from xxx import yyy" syntax from > files in the same directory? I'm sure it's been asked a million times, > but I can't seem to find the answer. Probably none that

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
Tobias Brox wrote: > A shell script containing some inline tcl is a shell script, though > when the only shell-command is "start up tcl" and the rest of the file > is tcl-code, I really don't think it can be defined as a "shell > script" anymore. Particularly not if almost all tcl-scripts are > s

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
ZeD wrote: > but... > > $ cat test.py > #!/usr/bin/env python > > print "Hello, world" > $ file test.py > file.py: a python script text executable > > following what you said, test.py is a /usr/bin/env script, not a python one. That's rather a silly interpretation of what I said, I think. Aft

Two Classes In Two Files

2006-08-09 Thread [EMAIL PROTECTED]
I just started working with Python and ran into an annoyance. Is there a way to avoid having to use the "from xxx import yyy" syntax from files in the same directory? I'm sure it's been asked a million times, but I can't seem to find the answer. For example, I have two classes stored in separate f

Re: Eval (was Re: Question about using python as a scripting language)

2006-08-09 Thread gene tani
Chris Lambacher wrote: > On Wed, Aug 09, 2006 at 11:51:19AM -0400, Brendon Towle wrote: > I don't disagree with you. The problem is that the obvious way to do it > (eval) is a big security hole. In this case you are trusting that no one > inserts themselves between you and the website providing

Re: Nested function scope problem

2006-08-09 Thread enigmadude
I agree with the previous comments that this approach is "bad form". But if you absolutely *must* modify an enclosing function's variables with an inner function, all you need to do is remember that a Python function is an object too, so it can be assigned attributes. ;-) def outer(): outer.x

Re: os.path.normpath

2006-08-09 Thread BartlebyScrivener
[EMAIL PROTECTED] wrote: > But if this string is going into a webpage link http://docs.python.org/lib/module-urlparse.html rd -- http://mail.python.org/mailman/listinfo/python-list

Re: Python share CPU time?

2006-08-09 Thread Grant Edwards
On 2006-08-09, Tim Chase <[EMAIL PROTECTED]> wrote: >> Problem is that I would have to share the CPU between all the robots, >> and thus allocate a time period to each robot. However I couldn't find >> any way to start a thread (robot), and interrupt it after a given time >> period. >> Any suggest

Re: (easy question) Find and replace multiple items

2006-08-09 Thread ds4ff1z
Tim Chase wrote: > > Hello, i'm looking to find and replace multiple characters in a text > > file (test1). I have a bunch of random numbers and i want to replace > > each number with a letter (such as replace a 7 with an f and 6 with a > > d). I would like a suggestion on an a way to do this. T

Re: Are there any AOP project in python community?

2006-08-09 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, I teased: . . . >with Python. I'd emphasize that Python *needs* AOP less >than do Java and C++. I've been asked in private e-mail if I "mean that Python is aspect-oriented from its beginning."

Re: Escape sequences (colour) and padding with "%8s"%

2006-08-09 Thread Tim Chase
> I used escape sequences to produce colour output, but a construct like > > print "%8s" % str_with_escape > > doesn't do the right thing. I suppose the padding counts the escape > characters, too. > > What could be a solution? You omit half of the equation: the contents of str_with_escape.

Re: __contains__ vs. __getitem__

2006-08-09 Thread David Isaac
> Alan Isaac wrote: > > I have a subclass of dict where __getitem__ returns None rather than > > raising KeyError for missing keys. (The why of that is not important for > > this question.) "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote: > Well, actually it may be important... What's so wrong wi

Announcing Switch, the CSS Preprocessor!

2006-08-09 Thread Dave
Powered by Mod_Python, Switch CSS is a full featured, production ready CSS preprocessor. Some of the features include: - variables - constants - selector prepending: #selector { .class { property: value; } } outputs: #selector { } #selector .class { property: value; } With unlimited

Re: Python share CPU time?

2006-08-09 Thread Tim Chase
> Problem is that I would have to share the CPU between all the robots, > and thus allocate a time period to each robot. However I couldn't find > any way to start a thread (robot), and interrupt it after a given time > period. > Any suggestions on how to proceed? >>> import thread, time >>> def

converting a nested try/except statement into try/except/else

2006-08-09 Thread John Salerno
I'm starting out with this: try: if int(text) > 0: return True else: self.error_message() return False except ValueError: self.error_message() return False I rewrote it as this: try: int(text) except ValueError: self.error_message() r

Re: What's the cleanest way to compare 2 dictionary?

2006-08-09 Thread Paddy
John Henry wrote: > Hi list, > > I am sure there are many ways of doing comparision but I like to see > what you would do if you have 2 dictionary sets (containing lots of > data - like 2 keys and each key contains a dozen or so of records) > and you want to build a list of differences about t

os.path.normpath

2006-08-09 Thread nathanbullock
I am using a windows box and passing a string like "../foo/../foo2" to normpath which then returns "..\\foo2". But if this string is going into a webpage link it should really be "../foo". Is there any way to tell os.path.normpath to act like we are an a unix style box? What about in the new pyth

Re: Python share CPU time?

2006-08-09 Thread enigmadude
There's several ways of doing concurrency in Python. Other than the threading module, have you tried FibraNet? It's designed with simple games in mind. You can download it at http://cheeseshop.python.org/pypi/FibraNet. Specifically the nanothreads module from FibraNet uses generators to simulate li

Re: Nested function scope problem

2006-08-09 Thread Gerhard Fiedler
On 2006-08-09 07:54:22, Slawomir Nowaczyk wrote: > But I do not believe there is any "identity of a variable" > which corresponds to "id()". Still, you used such term -- repeatedly. > > I do not know what do you mean by it. In C, the "identity" of anything is usually the memory location. Same l

Re: Python share CPU time?

2006-08-09 Thread Grant Edwards
On 2006-08-09, Yannick <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to program a small game in Python, kind of like robocode > (http://robocode.sourceforge.net/). > Problem is that I would have to share the CPU between all the robots, > and thus allocate a time period to each robot. However I

Re: Nested function scope problem

2006-08-09 Thread Gerhard Fiedler
On 2006-08-09 07:54:22, Slawomir Nowaczyk wrote: > It was never my goal to show that Python and C variables behave the > same way or anything. > > So it seems like we misunderstood each others intents. That seems to be the case :) I never really meant to say that I think that Python does not ha

What's the cleanest way to compare 2 dictionary?

2006-08-09 Thread John Henry
Hi list, I am sure there are many ways of doing comparision but I like to see what you would do if you have 2 dictionary sets (containing lots of data - like 2 keys and each key contains a dozen or so of records) and you want to build a list of differences about these two sets. I like to end

Re: Info on continuations?

2006-08-09 Thread vasudevram
Michael wrote: > vasudevram wrote: > > > > > Hi, > > > > I am Googling and will do more, found some stuff, but interested to get > > viewpoints of list members on: > > > > Continuations in Python. > > > > Saw a few URLs which had some info, some of which I understood. But > > like I said, personal

Re: Nested function scope problem

2006-08-09 Thread Gerhard Fiedler
On 2006-08-09 07:54:21, Slawomir Nowaczyk wrote: > Nope. Equivalence table can look like this: > >Python C > variable:a variable: a > textual representation: "a" address operator: &a > id of object: id

Re: __contains__ vs. __getitem__

2006-08-09 Thread enigmadude
That's a vague question, so the obligatory "it depends" response applies here. If you want to guard against the unexpected, perhaps it's a good idea to write unit tests rather than to take someone's word that it *should* work okay every time, in every case, no matter what you're doing with the dat

Python share CPU time?

2006-08-09 Thread Yannick
Hi, I would like to program a small game in Python, kind of like robocode (http://robocode.sourceforge.net/). Problem is that I would have to share the CPU between all the robots, and thus allocate a time period to each robot. However I couldn't find any way to start a thread (robot), and interrup

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Aahz
In article <[EMAIL PROTECTED]>, John Salerno <[EMAIL PROTECTED]> wrote: > >I understand the difference, but I'm just curious if anyone has any >strong feelings toward using one over the other? I was reading that a >disadvantage to the more general usage (i.e. env) is that it finds the >first py

Status of Epydoc

2006-08-09 Thread Kent Tenney
Howdy, I would very like to use Epydoc 3.0, however I've found a couple bugs and the mailing list; http://sourceforge.net/mailarchive/forum.php?forum_id=39919 doesn't seem to be working, the last couple messages I've posted haven't shown up. Does anyone know the status of Epydoc 3.0 development?

Escape sequences (colour) and padding with "%8s"%

2006-08-09 Thread Anton81
Hi all! I used escape sequences to produce colour output, but a construct like print "%8s" % str_with_escape doesn't do the right thing. I suppose the padding counts the escape characters, too. What could be a solution? Anton -- http://mail.python.org/mailman/listinfo/python-list

Re: Class data being zapped by method

2006-08-09 Thread Kevin M
Good news. I've fixed it up and all seems to be well. Thanks, all. I've learned a lot from this :) John Machin wrote: > Kevin M wrote: > > Inline > > > > > 1.) Why are you removing the .pyc file? > > > > After I had run the script once and subsequently changed the class > > file, I would run the

  1   2   >