Re: why functions in modules need 'global foo' for integer foo but not dictionary foo?

2005-07-28 Thread Paolino
Robert Kern wrote: > [EMAIL PROTECTED] wrote: > >>At top of a module I have an integer like so... >> >>foo = 4 >> >>In a function in that module I know I need to do 'global foo' to get at >>the value 4. >>... > > > I presume you are trying code like the following: > > foo = 4 > bar = {} > > d

Re: [path-PEP] Path inherits from basestring again

2005-07-28 Thread Stefan Rank
[__div__ for .joinpath()] on 29.07.2005 04:48 Tony Meyer said the following: >>I, herewith, claim to have used it in the past. >>But I am indifferent as to if its needed, it just looks natural to me. > > So far there seem to have been a few +0s, but no +1s... > >>What I use quite often is:: >> >

Re: functions without parentheses

2005-07-28 Thread Bengt Richter
On Thu, 28 Jul 2005 00:59:51 -0700 (PDT), Jerry He <[EMAIL PROTECTED]> wrote: >Hi, > Is it possible to create a function that you can use >without parenthesizing the arguments? for example, for > >def examine(str): > . > . > >Is there some way to define it so that I can call it >

Re: os._exit vs. sys.exit

2005-07-28 Thread Andrew Dalke
Bryan wrote: > Why does os._exit called from a Python Timer kill the whole process while > sys.exit does not? On Suse. os._exit calls the C function _exit() which does an immediate program termination. See for example http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/_e

Re: can list comprehensions replace map?

2005-07-28 Thread Andrew Dalke
Christopher Subich wrote: > My naive solution: ... >for i in ilist: > try: > g = i.next() > count += 1 > except StopIteration: # End of iter > g = None ... What I didn't like about this was the extra overhead of all the StopIt

Re: Regex for nested {}

2005-07-28 Thread Paul McGuire
Or use pyparsing, and do both at the same time (that spark example looks like a lot of work!). Download pyparsing at http://pyparsing.sourceforge.net. -- Paul from pyparsing import * text = """ outer { inner1 { ...1 } inner2 { ...2 } } simple { ...3 } null {}

Re: why functions in modules need 'global foo' for integer foo but not dictionary foo?

2005-07-28 Thread Robert Kern
[EMAIL PROTECTED] wrote: > At top of a module I have an integer like so... > > foo = 4 > > In a function in that module I know I need to do 'global foo' to get at > the value 4. > ... You don't. You need the global declaration to *set* the value of "foo" in the module's namespace. When getting

why functions in modules need 'global foo' for integer foo but not dictionary foo?

2005-07-28 Thread [EMAIL PROTECTED]
At top of a module I have an integer like so... foo = 4 In a function in that module I know I need to do 'global foo' to get at the value 4. ... IIRC, for dictionaries you DO NOT have this issue? Why this scope problem with integers but not dictionaries? Chris -- http://mail.python.org/mailm

Re: monitor a folder for file creation, how?

2005-07-28 Thread fanbanlo
SUPER! This is exactly what I'm looking for. gene tani wrote: > win32: (I posted this link in response to same question, um, day bef. > yesterday) > > http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/9a1c7629db72d064/56008cb68eeffa23?hl=en#56008cb68eeffa23 > (Thanks to Tim G

RE: Ten Essential Development Practices

2005-07-28 Thread Tony Meyer
[Robert Kern] > Sure, and I can find programming advice in the Old Testament, > too, if I try hard enough [...] > Proverbs 28:14 JPS "Happy is the man that feareth alway; > but he that hardeneth his heart shall fall into evil." > Obviously an exhortation to not ignore raised exceptions with > "ex

Re: Ten Essential Development Practices

2005-07-28 Thread Robert Kern
Dan Sommers wrote: > On Thu, 28 Jul 2005 15:35:54 -0700, > Robert Kern <[EMAIL PROTECTED]> wrote: > >>That said, I made a boo-boo. The Zen of Python is really a set of >>design principles (and some of them, like this one, are more >>specifically *language* design principles), not Essential Develop

Weekly Python Patch/Bug Summary

2005-07-28 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 357 open ( +7) / 2885 closed ( +3) / 3242 total (+10) Bugs: 898 open ( +9) / 5144 closed ( +3) / 6042 total (+12) RFE : 191 open ( +2) / 178 closed ( +0) / 369 total ( +2) New / Reopened Patches __ shutil.co

Re: pySerial Windows write problem

2005-07-28 Thread Bob Greschke
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message > > Actually, I'm curious why you don't do the same. I'd call it very unusual > (in my experience) to have a program open and close a serial port > repeatedly. Among other things, this means that the DSR/DTR lines are > toggling high and low

Re: Multithreaded class with queues

2005-07-28 Thread Aahz
In article <[EMAIL PROTECTED]>, Antal Rutz <[EMAIL PROTECTED]> wrote: > >I wrote a little class to make multihreading easier. It's based on one >of aahz's threading example scripts. What it does: Thanks! >It spawns up number of CollectorThreads and one ProcessThread. The >CollectorThreads listen

Re: monitor a folder for file creation, how?

2005-07-28 Thread gene tani
win32: (I posted this link in response to same question, um, day bef. yesterday) http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/9a1c7629db72d064/56008cb68eeffa23?hl=en#56008cb68eeffa23 (Thanks to Tim Golden for collecting the info) OS X: I dunno... -- http://mail.python.

Re: Regex for nested {}

2005-07-28 Thread skip
Chris> I have a problem matching nested levels of {} ... Regular expressions can't count, so you'd be better off sticking with regexes to tokenize the source, then use a real parser to parse the tokens it produces. Skip -- http://mail.python.org/mailman/listinfo/python-list

Ann: Registration for the Python Game Programming Challenge is now open!

2005-07-28 Thread pyweek1
Registration is now open for the first Python Game Programming Challenge (also known as PyWeek). The challenge runs from Sunday August 28th to Sunday September 4th. That means there's only (checks website) 29 days to go before the challenge starts! Full details about the challenge, and registrati

os._exit vs. sys.exit

2005-07-28 Thread Bryan
Quick question: Why does os._exit called from a Python Timer kill the whole process while sys.exit does not? On Suse. Bryan -- http://mail.python.org/mailman/listinfo/python-list

RE: [path-PEP] Path inherits from basestring again

2005-07-28 Thread Tony Meyer
> Well, I actually had some correspondence with Jason on this > very subject a year or so ago: [...] > Obviously, I don't know how much weight Jason's original > ideas have on the prepped-for-syslib module, but it does > support what other people have been saying: that the Path > should behave

RE: [path-PEP] Path inherits from basestring again

2005-07-28 Thread Tony Meyer
[using __div__ to mean join] > I'm not too happy with it, too, but do we have alternatives? > As paths are strings, we can hardly override the '+' operator, > so there's not much operators left. > > Of course, one can use joinwith() if he doesn't like '/'. My argument is that the alternative is

RE: [path-PEP] Path inherits from basestring again

2005-07-28 Thread Tony Meyer
> I, herewith, claim to have used it in the past. > > But I am indifferent as to if its needed, it just looks natural to me. So far there seem to have been a few +0s, but no +1s... > What I use quite often is:: > >path(__file__).dirname() / "somesiblingfileiknowisthere" > > you do not have

RE: [path-PEP] Path inherits from basestring again

2005-07-28 Thread Tony Meyer
> def functions_which_modifies_some_file_in_place(path): > output = open(path+'.tmp', 'w') > . > > I dont want a seperator inserted between path and the new extension. Fair enough. Forget using '+' for join, then (which I was never that keen on - TIOWTDI), but I'm still -1 on using '/' for

Re: monitor a folder for file creation, how?

2005-07-28 Thread Mike Meyer
fanbanlo <[EMAIL PROTECTED]> writes: > How do I monitor a folder for new file(s) creation? > How to use thread to do a wait until a new file is 'detected'? There's not a clean portable way to do this. The portable way is to poll the update time of the folder at regular intervals, and act when it

Re: Adding code and methods to a class dynamically

2005-07-28 Thread Peter Hansen
Sarir Khamsi wrote: > Thanks, this is amazingly more simple than what I had. This works > fine but I'm looking at the code for cmd and don't really see how you > get completion to work on the new alias. I'm not sure what "completion" means in this case, and I'm not aware of any "command-line comp

Re: Ten Essential Development Practices

2005-07-28 Thread Peter Hansen
Dan Sommers wrote: > The Zen applies to all aspects of software > (and other things, too, but they're off topic here), from human readable > reports and requirements and documentation, to GUI's, to test cases, to > code, to database schemta, as well as the development methodology and > practices th

Re: can list comprehensions replace map?

2005-07-28 Thread Christopher Subich
Andrew Dalke wrote: > Steven Bethard wrote: > >>Here's one possible solution: >> >>py> import itertools as it >>py> def zipfill(*lists): >>... max_len = max(len(lst) for lst in lists) > > > A limitation to this is the need to iterate over the > lists twice, which might not be possible if one o

Re: pySerial Windows write problem

2005-07-28 Thread Peter Hansen
Bob Greschke wrote: > I didn't write the C++ program, but it looks like it never closes the serial > port. It opens it when it starts up, then keeps it open until it quits. > Tsk tsk tsk. Sloppy. Maybe they did that to cover up this problem. :) Actually, I'm curious why you don't do the same.

Hello

2005-07-28 Thread brian
The message cannot be represented in 7-bit ASCII encoding and has been sent as a binary attachment. -- Virus Warning Message (on cse.iitkgp.ernet.in) body.scr is removed from here because it contains a virus. --- http://

Re: Rich Graphics?

2005-07-28 Thread corey . coughlin
for widgets, try pyUI http://pyui.sourceforge.net/ hope that helps, looks cool and all.. -- http://mail.python.org/mailman/listinfo/python-list

pyUI?

2005-07-28 Thread corey . coughlin
I think someone built a gui on top of pygame a while back, I think it was called pyUI or something, let's see what google gives me here, ah, here we go http://pyui.sourceforge.net/ Hope that helps. Looks like neat stuff anyway... -- http://mail.python.org/mailman/listinfo/python-list

monitor a folder for file creation, how?

2005-07-28 Thread fanbanlo
How do I monitor a folder for new file(s) creation? How to use thread to do a wait until a new file is 'detected'? Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: Cgi scripts in apache not working

2005-07-28 Thread Bruno Desthuilliers
David a écrit : > I've looked all over the place for an answer, and the only one I can > find doesn't mean anything to me. The end of line issue with writting > it in Windows and then uploading it doesn't help me since I'm doing > this all from Linux. I've been trying to get python cgi scripts to >

Python fails compiling in socket extension

2005-07-28 Thread stefvienna
Hi group, I'm trying compiling Python-2.4.1 and it fails builing the _socket extension with the following message: building '_socket' extension gcc -pthread -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -fno-strict-aliasing -I. -I/usr/local/src/Python-2.4.1/./Include -I/usr/local/include -I/usr

Re: Ten Essential Development Practices

2005-07-28 Thread Dan Sommers
On Thu, 28 Jul 2005 15:35:54 -0700, Robert Kern <[EMAIL PROTECTED]> wrote: > That said, I made a boo-boo. The Zen of Python is really a set of > design principles (and some of them, like this one, are more > specifically *language* design principles), not Essential Development > Practices. That'll

Re: poplib.POP3.list() returns extra value?

2005-07-28 Thread Jeff Epler
With a judicious bit of UTSL, that count seems to be the total number of octets in the reply. This information comes from any user of _getlongresp(), which actually returns a tuple (resp, list, octets). These methods would be: list retr top uidl I'd consider it a doc bug too. If

Re: Adding code and methods to a class dynamically

2005-07-28 Thread Sarir Khamsi
Peter Hansen <[EMAIL PROTECTED]> writes: > If it's truly just an alias you want, then something like this should > work better. Replace everything in the if mo: section with this: > > if mo: > newName = mo.group(1) > existingName = mo.group(2) > existingMethod = getattr(self, 'do_'

Re: c/c++ extensions and help()

2005-07-28 Thread Robert Kern
Lenny G. wrote: > Is there a way to make a c/c++ extension have a useful method > signature? Right now, help(myCFunc) shows up like: > > myCFunc(...) > description of myCFunc > > I'd like to be able to see: > > myCFunc(myArg1, myArg2) > description of myCFunc > > Is this currently possible

Re: pySerial Windows write problem

2005-07-28 Thread Bob Greschke
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Bob Greschke wrote: > > But writing anything to the port >> quickly (not always right away...like maybe 5-6 iterations through the >> loop?) causes the >> >> win32file.CloseHandle(self.hComPort) >> >> statement in th

c/c++ extensions and help()

2005-07-28 Thread Lenny G.
Is there a way to make a c/c++ extension have a useful method signature? Right now, help(myCFunc) shows up like: myCFunc(...) description of myCFunc I'd like to be able to see: myCFunc(myArg1, myArg2) description of myCFunc Is this currently possible? Thanks, Lenny G. -- http://mail.py

Re: Ten Essential Development Practices

2005-07-28 Thread Robert Kern
Michael Hoffman wrote: > Aahz wrote: > >>>One of these days I'm going to figure out how to embody "Namespaces are >>>one honking great idea -- let's do more of those!" Then I shall be >>>enlightened. >> >>What don't you understand about it? (This is a serious question -- I >>can think of severa

Re: pySerial Windows write problem

2005-07-28 Thread Peter Hansen
Bob Greschke wrote: > But writing anything to the port > quickly (not always right away...like maybe 5-6 iterations through the > loop?) causes the > > win32file.CloseHandle(self.hComPort) > > statement in the 'def close(self)' function of the serialwin32.py file of > the pySerial package

Re: Cgi scripts in apache not working

2005-07-28 Thread Paul Boddie
David wrote: > > httpd.conf: > > << Tried it with "" and no "" > Options ExecCGI << Tried with "Options +ExecCGI" > AddHandler cgi-script .cgi .py << Tried with "SetHandler > cgi-script", but still no go > > > > error_log: > > [Thu Jul 28 11:44:53 2005] [er

Re: Friend wants to learn python

2005-07-28 Thread Stuart Turner
EnderLocke wrote: > I have a friend who wants to learn python programming. I learned off > the internet and have never used a book to learn it. What books do you > recommend? > > Any suggestions would be appreciated. I've just been learning Python and used a combination of 'Python in a Nutshell

Re: Ten Essential Development Practices

2005-07-28 Thread Michael Hoffman
Aahz wrote: >>One of these days I'm going to figure out how to embody "Namespaces are >>one honking great idea -- let's do more of those!" Then I shall be >>enlightened. > > What don't you understand about it? (This is a serious question -- I > can think of several answers to give you, but wan

Re: Ten Essential Development Practices

2005-07-28 Thread Aahz
In article <[EMAIL PROTECTED]>, Michael Hoffman <[EMAIL PROTECTED]> wrote: >Robert Kern wrote: >> >> import this >> >> And you get 9 bonus Essential Development Practices, too! What a bargain! > >One of these days I'm going to figure out how to embody "Namespaces are >one honking great idea -- l

poplib.POP3.list() returns extra value?

2005-07-28 Thread Steve Greenland
For the poplib.POP3 object, docs say: list([which]) Request message list, result is in the form (response, ['mesg_num octets', ...]). If which is set, it is the message to list. But (I've folded the long line): Python 2.3.5 (#2, May 4 2005, 08:51:39) [GCC 3.3.5 (Debian 1:3.3.5-12)] o

Re: On fighting fire with fire...

2005-07-28 Thread Asad Habib
Well, even if you are a hobbyist, that does not excuse you from being civil. After all, we are all humans beings that deserve to be treated with respect. Professional, hobbyist, vagabond, ogre, instigator, troll ... THERE IS NO EXCUSE ... please treat others with respect. - Asad On Thu, 28 Jul 2

Re: To thread or not to thread

2005-07-28 Thread Grant Edwards
On 2005-07-28, Sidd <[EMAIL PROTECTED]> wrote: > I was recently reading an article on threading in python and I > came across Global Interpreter Lock,now as a novince in python > I was cusrious about > > 1.Is writing a threaded code in python going to perform well > than a normal python code. I

Re: On fighting fire with fire...

2005-07-28 Thread Rocco Moretti
Asad Habib wrote: > I agree with Mustafa. After all, we are a bunch of professionals and not > vagabonds hired to take pot shots at one another. Except that we're not all professionals. There are a large number of hobbyists who use Python and this list. At any rate, my suggestion was not to fors

Re: pySerial Windows write problem

2005-07-28 Thread bob
I forgot to mention that once the Python program(s) fail, THEN the C++ program also fails to opne the port, and the equipment has to be power-cycled to get things to work again. Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: Ten Essential Development Practices

2005-07-28 Thread Dan Sommers
On Thu, 28 Jul 2005 21:19:53 +0100, Michael Hoffman <[EMAIL PROTECTED]> wrote: > Robert Kern wrote: >> import this >> And you get 9 bonus Essential Development Practices, too! What a >> bargain! > One of these days I'm going to figure out how to embody "Namespaces are > one honking great idea --

Re: retrieve data from 2 database

2005-07-28 Thread Steve Holden
crespoh wrote: > Hi, > > How do I select data from two tables from two different databases and > compare them? using dbi,odbc > Well, a lot depends on the database. If it's two Access .mdb files, for example, or two different databases in a single SQL Server instance, sometimes you can use SQL

Re: how to get function signature

2005-07-28 Thread Colin J. Williams
Robert Kern wrote: > [EMAIL PROTECTED] wrote: > >> Hi, >> >> I was working on a dir like function that gives more information than >> the usual dir, but I am not satisfied with the way I get function >> arguments for callable members of an object. Take a look at it here: >> http://nerdierthanthou.

Re: Ten Essential Development Practices

2005-07-28 Thread Michael Hoffman
Robert Kern wrote: > import this > > And you get 9 bonus Essential Development Practices, too! What a bargain! One of these days I'm going to figure out how to embody "Namespaces are one honking great idea -- let's do more of those!" Then I shall be enlightened. -- Michael Hoffman -- http://

Re: On fighting fire with fire...

2005-07-28 Thread Robert Kern
Asad Habib wrote: > What, do you not consider yourself a professional? Not really, no. > Just because you are in > academia does not justify attacking people on a mailing list and then > justifying your attack with Harter's quote! Uh, it was a joke. A self-denigrating joke. I was calling *myself

Re: codecs.getencoder encodes entire string ?

2005-07-28 Thread Martin v. Löwis
nicolas_riesch wrote: > I just don't understand why it returns the "length consumed". > > Does it means that in some case, the input string can be only partially > converted ? For an encoder, I believe the answer is "no". For a decoder, it is a definite yes: if the input does not end with a comp

pySerial Windows write problem

2005-07-28 Thread Bob Greschke
We have some equipment that communicates at 57600 baud RS232. The path from the PC is USB to a Phillips USB hub, then off of that a TUSB3410 USB/Serial converter. The driver for the 3410 chip creates a "normal" comm port (like COM3). There is a C++ program that has no problem talking to the e

Re: On fighting fire with fire...

2005-07-28 Thread Asad Habib
What, do you not consider yourself a professional? Just because you are in academia does not justify attacking people on a mailing list and then justifying your attack with Harter's quote! Life is more than a quote - look outside your academic cocoon and you will realize what I mean. - Asad On T

Re: Determine if object is a Bound or Unbound method

2005-07-28 Thread Farshid Lashkari
Grazie! Paolino wrote: > Farshid Lashkari wrote: > >> Hi, >> >> I have an object and I want to check if it is a bound or unbound >> method, or neither. I tried using the types module, but it seems as >> though types.UnboundMethodType and types.MethodType are equal. How >> else can I determine

Re: Ten Essential Development Practices

2005-07-28 Thread Robert Kern
[EMAIL PROTECTED] wrote: > The following url points to an article written by Damian Conway > entitled "Ten Essential Development Practices": > http://www.perl.com/pub/a/2005/07/14/bestpractices.html > > Althought the article has Perl as a focus, I thought that some of the > general points made mig

Re: Ten Essential Development Practices

2005-07-28 Thread Jeremy Moles
> He spends so much space on "Create Consistent Command-Line Interfaces," > a section that, in Python, could be replaced with a simple "Use optparse." Haha... I don't know why but that really made me laugh. :) Might even use it as a sig or something... :) > -- > Michael Hoffman -- http://ma

Re: On fighting fire with fire...

2005-07-28 Thread Robert Kern
Asad Habib wrote: > I agree with Mustafa. After all, we are a bunch of professionals and not > vagabonds hired to take pot shots at one another. Speak for yourself. ;-) -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die.

Re: Determine if object is a Bound or Unbound method

2005-07-28 Thread Paolino
Farshid Lashkari wrote: > Hi, > > I have an object and I want to check if it is a bound or unbound method, > or neither. I tried using the types module, but it seems as though > types.UnboundMethodType and types.MethodType are equal. How else can I > determine this? BTW, I'm using Python 2.3 >

Re: multiple inheritance super()

2005-07-28 Thread rafi
Michele Simionato wrote: >>http://fuhm.org/super-harmful/ > > > That is a pretty good page; I must say that my position is more radical > (i.e. it is not super which > is harmful, it is multiple inheritance itself that it is harmful: was I > going to design a new language > I would implement it *

Re: Ten Essential Development Practices

2005-07-28 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: > The following url points to an article written by Damian Conway > entitled "Ten Essential Development Practices": > http://www.perl.com/pub/a/2005/07/14/bestpractices.html > > Althought the article has Perl as a focus, I thought that some of the > general points made mig

To thread or not to thread

2005-07-28 Thread Sidd
Hello, I was recently reading an article on threading in python and I came across Global Interpreter Lock,now as a novince in python I was cusrious about 1.Is writing a threaded code in python going to perform well than a normal python code.If so on what basis can it performance be measured

Ten Essential Development Practices

2005-07-28 Thread gyromagnetic
The following url points to an article written by Damian Conway entitled "Ten Essential Development Practices": http://www.perl.com/pub/a/2005/07/14/bestpractices.html Althought the article has Perl as a focus, I thought that some of the general points made might be of interest to the Python commu

Determine if object is a Bound or Unbound method

2005-07-28 Thread Farshid Lashkari
Hi, I have an object and I want to check if it is a bound or unbound method, or neither. I tried using the types module, but it seems as though types.UnboundMethodType and types.MethodType are equal. How else can I determine this? BTW, I'm using Python 2.3 Thanks, Farshid -- http://mail.pyth

Re: On fighting fire with fire...

2005-07-28 Thread Asad Habib
I agree with Mustafa. After all, we are a bunch of professionals and not vagabonds hired to take pot shots at one another. - Asad On Thu, 28 Jul 2005, mustafa wrote: > Rocco Moretti wrote: > > projecktzero wrote: > > > >>but..but...It's so much more fun to unleash your anger and fire back > >>w

Re: On fighting fire with fire...

2005-07-28 Thread mustafa
Rocco Moretti wrote: > projecktzero wrote: > >>but..but...It's so much more fun to unleash your anger and fire back >>with all guns blazing fanning the flame war that most discussion groups >>degenerate into after a couple of responses. =) >> >>Actually, I had some self restraint yesterday. I want

Re: Adding code and methods to a class dynamically

2005-07-28 Thread Peter Hansen
Sarir Khamsi wrote: > I have a class (Command) that derives from cmd.Cmd and I want to add > methods to it dynamically. I've added a do_alias() method and it would > be nice if I could turn an alias command into a real method of Command > (that way the user could get help and name completion). The

Re: Regex for nested {}

2005-07-28 Thread Diez B.Roggisch
> constructs like a**nn**n, with a={ and b=} in your case. This should have been a**nb**n - an example would be aaabbb. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Advanced concurrancy

2005-07-28 Thread Paolino
Peter Tillotson wrote: > Hi, > > I'm looking for an advanced concurrency module for python and don't seem > to be able to find anything suitable. Does anyone know where I might > find one? I know that there is CSP like functionality built into > Stackless but i'd like students to be able to use

Re: Advanced concurrancy

2005-07-28 Thread jemfinch
Asynchrony is not concurrency. If you have to turn your code "inside out," (that is, if you have to write your code such that the library calls your code, rather than vice versa) it's very much *not* concurrency: it's just asynchrony. While Twisted makes asynchronous code relatively easy to write

Re: Rich Graphics?

2005-07-28 Thread Bernhard Herzog
Chris Spencer <[EMAIL PROTECTED]> writes: > I'm trying to write a Gui in Python for manipulating rich graphical > representations, similar to something like Inkscape. I've tried tkinter, > wxPython, pyGtk, and while they all do traditional widgets well enough, > none of them really handle anti-ali

Adding code and methods to a class dynamically

2005-07-28 Thread Sarir Khamsi
I have a class (Command) that derives from cmd.Cmd and I want to add methods to it dynamically. I've added a do_alias() method and it would be nice if I could turn an alias command into a real method of Command (that way the user could get help and name completion). The code would be generated dyna

Cgi scripts in apache not working

2005-07-28 Thread David
I've looked all over the place for an answer, and the only one I can find doesn't mean anything to me. The end of line issue with writting it in Windows and then uploading it doesn't help me since I'm doing this all from Linux. I've been trying to get python cgi scripts to work, and I always end up

Re: Graphics files & Python

2005-07-28 Thread Terry Reedy
"Pekka Karjalainen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How can I create image files and animations with Python? Besides the other responses, you might also check out the pygame site where there once were some tutorial examples of manipulating bitmaps with Numerical

Re: Advanced concurrancy

2005-07-28 Thread Calvin Spealman
Twisted [1] includes lots of support for asyncronous concurrency, using deferreds. There is also the possiblity of PEP 342's [2] concurrency through enhanced generators, and being able to pass data to the generator every iteration. There are ways to simulate this, as well. I've written a recipe [3]

ANN: Python training, 2005 Aug 29-31, San Francisco

2005-07-28 Thread wesc
What: Python Programming I: Introduction to Python When: August 29-31, 2005 Where: San Francisco, CA, USA Need to get up-to-speed with Python as quickly as possible? Come join us in beautiful Northern California the week before Labor Day. We are proud to announce another rigorous Python tra

Re: Regex for nested {}

2005-07-28 Thread Diez B.Roggisch
Chris cdot.de> writes: > > is something like that possible? No. Not with "pure" regexes. The reason is that the theory behind them doesn't allow to detect syntactic constructs like a**nn**n, with a={ and b=} in your case. What you need is a "real" parser - usually one uses regexes to split th

Re: functions without parentheses

2005-07-28 Thread bruno modulix
Jerry He wrote: > Hi, > Is it possible to create a function that you can use > without parenthesizing the arguments? for example, for > > def examine(str): > . > . > > Is there some way to define it so that I can call it > like > > examine "string" > instead of examine("str

Re: Rich Graphics?

2005-07-28 Thread Daniel Dittmar
Chris Spencer wrote: > I'm trying to write a Gui in Python for manipulating rich graphical > representations, similar to something like Inkscape. I've tried tkinter, > wxPython, pyGtk, and while they all do traditional widgets well enough, > none of them really handle anti-aliased, transparent,

xml-object mapping

2005-07-28 Thread Tamas Hegedus
Hi! I am looking for an xml-object mapping tool ('XML Data Binding-design time product') where I can define the mapping rules in 'binding files' and the parser is generated automatically. Similar to the solution of Dave Kuhlman (http://www.rexx.com/~dkuhlman/generateDS.html) where the mapping

Regex for nested {}

2005-07-28 Thread Chris
hello, I have a problem matching nested levels of {}, example: >>> import re >>> text = """ outer { inner1 { ... } inner2 { ... } } simple { ... } """ >>> r = re.compile(r""" ( # OPTION1 .*? # begin

Re: baffling error-handling problem

2005-07-28 Thread Scott David Daniels
Chris Fonnesbeck wrote: > I thought I knew how to do error handling in python, but apparently I > dont. I have a bunch of code to calculate statistical likelihoods, and > use error handling to catch invalid parameters. For example, for the > bernoulli distribution, I have: > > def bernoulli_li

Re: codecs.getencoder encodes entire string ?

2005-07-28 Thread Jeff Epler
On Thu, Jul 28, 2005 at 08:42:57AM -0700, nicolas_riesch wrote: > And a last question: can I call this "enc" function from multiple > threads ? Yes. Jeff pgphSka1eU9PQ.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: functions without parentheses

2005-07-28 Thread Scott David Daniels
Jerry He wrote: > ... Is there some way to define [examine] so I can call it like > examine "string" > instead of examine("string")? Perhaps you are looking for ipython (google for it) if all you are looking for is ease of interactive entry. --Scott David Daniels [EMAIL PRO

Re: baffling error-handling problem

2005-07-28 Thread Michael Hudson
Chris Fonnesbeck <[EMAIL PROTECTED]> writes: > I thought I knew how to do error handling in python, but apparently I > dont. I have a bunch of code to calculate statistical likelihoods, and > use error handling to catch invalid parameters. For example, for the [...] > bernoulli distribution, I h

Re: Create a variable "on the fly"

2005-07-28 Thread Scott David Daniels
Paul D.Smith wrote: >... What I'm left with is the following... > 1. A shell script which I maintain. > 2. A simple Python config which searches for all shell environment variables > named "MY_..." and instantiates then as Python variables. > 3. Historical scripts that run without me needing to spe

Re: Why Tcl/Tk?

2005-07-28 Thread Thomas Bartkus
"William Park" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jerry He <[EMAIL PROTECTED]> wrote: > > I'm a little curious, why does most scripting > > languges(i.e. python and ruby) use Tcl/Tk rather than > > wx or Fox as its standard GUI? Although I did notice > > that the Vpython

codecs.getencoder encodes entire string ?

2005-07-28 Thread nicolas_riesch
When I use an encoder function from codecs module, documentation says that it encodes the object input and returns a tuple (output object, length consumed). >>> import codecs >>> enc=codecs.getencoder('iso-8859-1') >>> enc(u'asdf') ('asdf', 4) >>> I just don't understand why it returns the "leng

Re: Rich Graphics?

2005-07-28 Thread Adriaan Renting
I realy like Qt through PyQt. The combination Eric3+Qtdesigner is quite useful. Maybe PyQt is not yet ready for the new Qt4 I think, but it does lot's of the graphical stuff you seem to require. Adriaan Renting| Email: [EMAIL PROTECTED] ASTRON | Phone: +31 521 595 217 P.O.

Re: functions without parentheses

2005-07-28 Thread gene tani
http://onestepback.org/index.cgi/Tech/Ruby/PythonAndRuby.rdoc this blog talks about design differences, e.g. what "." means, whether functions and methods are 1st-class objects. St -- http://mail.python.org/mailman/listinfo/python-list

Advanced concurrancy

2005-07-28 Thread Peter Tillotson
Hi, I'm looking for an advanced concurrency module for python and don't seem to be able to find anything suitable. Does anyone know where I might find one? I know that there is CSP like functionality built into Stackless but i'd like students to be able to use a standard python build. I'm tryi

Re: functions without parentheses

2005-07-28 Thread Steven Bethard
Jerry He wrote: > def examine(str): > . > . > > Is there some way to define it so that I can call it > like > > examine "string" > instead of examine("string")? What do you want to happen when someone types: examine ??? Or better yet, what if you do something like:

Re: Freeze

2005-07-28 Thread pythonUser_07
What happens when you take a copy of python23.dll and put it in the path on that machine? Does the program run? If so, (and I am not familiar with freeze) it seems freeze did not put the dll into the .exe file. -- http://mail.python.org/mailman/listinfo/python-list

Re: functions without parentheses

2005-07-28 Thread bruno modulix
Simon Dahlbacka wrote: > If you actually want that kind of syntax, then why don't you use Visual > Basic? ;) s/VisualBasic/Ruby/ -- bruno desthuilliers ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p| p.split('.').collect{|w| w.reverse}.join('.')}.join('@')" -- http://mail.python.org/

Re: Create a variable "on the fly"

2005-07-28 Thread Steven Bethard
Paul D.Smith wrote: > 2. A simple Python config which searches for all shell environment variables > named "MY_..." and instantiates then as Python variables. my_vars = dict((k, v) for k, v in os.environ.iteritems() if k.startswith('MY_')) globals().update(my_vars)

Re: Trigger pygtk drawingarea redraw

2005-07-28 Thread ch424
Ahh.. fantastic! Flickers be gone! Yaarrrg! It was "self.area.queue_draw()" in case anyone wants to know. :) Thanks so much! Alex -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >