Upcoming Python Classes in New York

2009-12-08 Thread Steve Holden
Holden Web is pleased to announce three upcoming classes in New York city the week of January 18. Jan 18-20Introduction to Python (3 days) - Steve Holden http://holdenweb.com/py/introclass/ Jan 21 .NET: IronPython from the Ground Up (1 day) - Michael Foord http://holdenweb.com/py/ironpython/

Re: Why Doesn't XP Pro Show Size, Time and Date Mod of a Created File?

2009-12-08 Thread Gerhard Häring
W. eWatson wrote: I created a folder, and wrote a file to it. When I look at what files are in it, they are correct. However, The Size, Type, and Date Mod are not shown. Why am I missing those columns? I'm writing files with a suffix of dat, which seem only to match up with video CD movie.

Re: Graph library for Python

2009-12-08 Thread geremy condra
On Mon, Dec 7, 2009 at 11:28 PM, geremy condra debat...@gmail.com wrote: On Mon, Dec 7, 2009 at 6:28 PM, M.-A. Lemburg m...@egenix.com wrote: geremy condra wrote: On Mon, Dec 7, 2009 at 2:51 PM, M.-A. Lemburg m...@egenix.com wrote: geremy condra wrote: How interested are you in a C port of

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread John Machin
On Dec 8, 6:56 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Tue, 8 Dec 2009 08:26:58 +0530, 74yrs old withblessi...@gmail.com declaimed the following in gmane.comp.python.general: For Kannada project .txt(not .doc) is used, my requirement is to have one space between two characters

whitespace in xml output

2009-12-08 Thread wadi wadi
Hi all, I am creating some xml output using minidom and saving it to a file using doc.writexml() The output however is as follows: ?xml version=1.0 ? info Author bill catman /Author /info Is there a way to save xml output in a file such as xml is formatted the right way? I mean with

Re: how to convert string function to string method?

2009-12-08 Thread Bruno Desthuilliers
Dr. Phillip M. Feldman a écrit : Bruno- You've made some excellent suggestions, and I'm always grateful for the opportunity to learn. Glad to know I've been of any help !-) My revised code appears below. Philllip def strip_pairs(s, open='([{\'', close=')]}\''): OVERVIEW This

Upcoming Python Classes in New York

2009-12-08 Thread Steve Holden
Holden Web is pleased to announce three upcoming classes in New York city the week of January 18. Jan 18-20Introduction to Python (3 days) - Steve Holden http://holdenweb.com/py/introclass/ Jan 21 .NET: IronPython from the Ground Up (1 day) - Michael Foord http://holdenweb.com/py/ironpython/

Re: whitespace in xml output

2009-12-08 Thread Lutz Horn
Hi, wadi wadi wadie...@gmail.com wrote: I am creating some xml output using minidom and saving it to a file using doc.writexml() Could you please add some code of *how* you add the content bill catman to the Author element? It seems as if whitespace is an issue here. Lutz --

Re: How decoupled are the Python frameworks?

2009-12-08 Thread Martin Sand Christensen
J Kenneth King ja...@agentultra.com writes: [...] (though it sounds like cherrypy would be very good at separating dispatching from application code). True. In CherryPy, each page is represented by one method (the 'default' method is an exception, but that's not for this discussion). This

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread steve
On 12/08/2009 02:19 PM, John Machin wrote: [...snip...] Perhaps there are some subtleties of which we are unaware ... I would be very surprised if the OP could not find on a forum much closer to home more people who know more about using Indic scripts on computers than here. That's true.

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread 74yrs old
Steve, Thanks for the recommendation. In fact, I was not aware of Bangalore Python User Group till I received your email. I am very much thankful to you Sir, With Regards, -sriranga(77yrsold) On Tue, Dec 8, 2009 at 4:12 PM, steve st...@lonetwin.net wrote: On 12/08/2009 02:19 PM, John Machin

Re: How decoupled are the Python frameworks?

2009-12-08 Thread Lie Ryan
On 12/8/2009 9:11 PM, Martin Sand Christensen wrote: If the user isn't currently signed in to our CAS, he'll be redirected to the sign-in page and, after signing in, is returned to the page he originally requested. The role decorator checks his privileges (based on his CAS credentials) and

Re: How decoupled are the Python frameworks?

2009-12-08 Thread Diez B. Roggisch
shocks wrote: Hi I'm getting back into Python after a long break. I've been developing large enterprise apps solely with Adobe Flex (ActionScript) for the past couple years. During that time I've used a number of 'MVC' frameworks to glue the bits together - among them Cairngorm, a

Re: How decoupled are the Python frameworks?

2009-12-08 Thread Martin Sand Christensen
Lie Ryan lie.1...@gmail.com writes: In the end, it is the developer's responsibility not to write something too tightly coupled with their framework, isn't it? (or at least to minimize the framework-specific code to a certain area) That's a good summary of my point. However, I have very

Re: Duplicates of third-party libraries

2009-12-08 Thread Lie Ryan
On 12/8/2009 3:25 PM, Martin P. Hellwig wrote: Ben Finney wrote: Martin P. Hellwig martin.hell...@dcuktec.org writes: cut Along with the duplication this introduces, it also means that any bug fixes — even severe security fixes — in the third-party code will not be addressed in your

Re: Graph library for Python

2009-12-08 Thread Robin Becker
geremy condra wrote: ... I don't have a problem with adding this if there's a strong desire for it, but at the moment I'm leaning towards a wait-and-see approach, for all the reasons you described. Geremy Condra I don't want to sound pessimistic, but graph and digraph theory has a

Re: Duplicates of third-party libraries

2009-12-08 Thread Martin P. Hellwig
Lie Ryan wrote: cut dependencies should be done by the OS Yes from an argumentative perspective you are right. But given the choice of being right and alienate the fast majority of my potential user base, I rather be wrong. For me the 'Although practicality beats purity' is more important

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread John Machin
On Dec 8, 9:42 pm, steve st...@lonetwin.net wrote: On 12/08/2009 02:19 PM, John Machin wrote: [...snip...] Perhaps there are some subtleties of which we are unaware ... I would be very surprised if the OP could not find on a forum much closer to home more people who know more about

Re: Duplicates of third-party libraries

2009-12-08 Thread David Cournapeau
On Tue, Dec 8, 2009 at 9:02 PM, Lie Ryan lie.1...@gmail.com wrote: I disagree, what you should have is an Operating System with a package management system that addresses those issues. The package management must update your software and your dependencies, and keep track of incompatibilities

Re: python proxy checker ,change to threaded version

2009-12-08 Thread Lie Ryan
On 12/8/2009 8:43 AM, Rhodri James wrote: def run(self): result = func(*func_args) # matching run_in_thread param names callback(result, *callback_args) Neat, but I think you mean if callback is not None: callback(result, *callback_args) for that last line. how about: import threading def

Re: IO Gurus: what are the differences between these two methods?

2009-12-08 Thread Ulrich Eckhardt
dpapathanasiou wrote: I have two methods for writing binaries files: the first works with data received by a server corresponding to a file upload, and the second works with data sent as email attachments. Hmmm, no. Looking at your code, the first of your functions actually treats its argument

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread r0g
Dennis Lee Bieber wrote: On Tue, 8 Dec 2009 08:26:58 +0530, 74yrs old withblessi...@gmail.com declaimed the following in gmane.comp.python.general: For Kannada project .txt(not .doc) is used, my requirement is to have one snip In this context, I request you kindly for small python program -

Re: Duplicates of third-party libraries

2009-12-08 Thread Lie Ryan
On 12/9/2009 12:02 AM, David Cournapeau wrote: On Tue, Dec 8, 2009 at 9:02 PM, Lie Ryanlie.1...@gmail.com wrote: I disagree, what you should have is an Operating System with a package management system that addresses those issues. The package management must update your software and your

Re: Graph library for Python

2009-12-08 Thread Steven D'Aprano
On Tue, 08 Dec 2009 03:06:29 -0500, geremy condra wrote: [snip 215 lines of quoted-quoted-quoted-quoted-quoted text] In the future, would you mind trimming the unneeded quoting from your post? There's no need to duplicate the *entire* conversation in *every* post, and it is awfully AOL-like of

Re: python proxy checker ,change to threaded version

2009-12-08 Thread r0g
Lie Ryan wrote: On 12/8/2009 8:43 AM, Rhodri James wrote: def run(self): result = func(*func_args) # matching run_in_thread param names callback(result, *callback_args) Neat, but I think you mean if callback is not None: callback(result, *callback_args) for that last line. how about:

Re: Duplicates of third-party libraries

2009-12-08 Thread Grant Edwards
On 2009-12-08, Martin P. Hellwig martin.hell...@dcuktec.org wrote: - In the ideal world, a upgrade of a dependency won't break your program, in reality users fear upgrading dependencies because they don't know for sure it won't result in a dll hell type of problem. In my experience

no module named error

2009-12-08 Thread Joe
I am trying to write/run a python script which imports from another script which is located in my /usr/lib64/python2.6/site-packages/ dir, but getting the following error. $ python ./mytest.py Traceback (most recent call last): File ./mytest.py, line 45, in module from moda import *

relative imports with the __import__ function

2009-12-08 Thread Chris Colbert
I have package tree that looks like this: main.py package __init__.py configuration.ini server __init__.py xmlrpc_server.py controller.py reco irrelevant.py's segmentation __init__.py red_objects.py other irrelevant

Re: no module named error

2009-12-08 Thread Diez B. Roggisch
Joe wrote: I am trying to write/run a python script which imports from another script which is located in my /usr/lib64/python2.6/site-packages/ dir, but getting the following error. $ python ./mytest.py Traceback (most recent call last): File ./mytest.py, line 45, in module from

Re: Duplicates of third-party libraries

2009-12-08 Thread Martin P. Hellwig
Lie Ryan wrote: cut The only thing that package managers couldn't provide is for the extremist bleeding edge; those that want the latest and the greatest in the first few seconds the developers releases them. The majority of users don't fall into that category, most users are willing to wait

Re: no module named error

2009-12-08 Thread Joe
But it's searching for _moda.*, most probably a binary extension. Does that exist, and if yes, has it the proper architecture or is it maybe 32 bit? I'm just going by an example script. moda is a package I was given that is written in C and has some python bindings and does run 64-bit. I'm on

Re: no module named error

2009-12-08 Thread Diez B. Roggisch
Joe wrote: But it's searching for _moda.*, most probably a binary extension. Does that exist, and if yes, has it the proper architecture or is it maybe 32 bit? I'm just going by an example script. moda is a package I was given that is written in C and has some python bindings and does run

Re: SUB-MATRIX extraction

2009-12-08 Thread Jon Clements
On Dec 8, 1:36 pm, Pierre pierre.gaill...@gmail.com wrote: Hello, let b = array([ [0,1,2] , [3,4,5] , [6,7,8] ]) How can I easily extract the submatrix [ [0 ,1], [3, 4]] ? One possiblity is : b[[0,1],:][:,[0,1]] but it is not really easy ! Thanks. x = numpy.array([ [0,1,2], [3,4,5],

Re: Generators.

2009-12-08 Thread Jorge Cardona
2009/12/7 Taylor tsutton...@gmail.com: On Dec 7, 1:29 pm, Jorge Cardona jorgeecard...@gmail.com wrote: 2009/12/7 Lie Ryan lie.1...@gmail.com: On 12/7/2009 7:22 AM, Jorge Cardona wrote: Hi, I was trying to create a function that receive a generator and return a list but that each

Re: Duplicates of third-party libraries

2009-12-08 Thread Grant Edwards
On 2009-12-08, Martin P. Hellwig martin.hell...@dcuktec.org wrote: Lie Ryan wrote: cut The only thing that package managers couldn't provide is for the extremist bleeding edge; those that want the latest and the greatest in the first few seconds the developers releases them. The majority

Re: Question on Python as career

2009-12-08 Thread Bruno Desthuilliers
joy99 a écrit : (snip) I was thinking if I need to know Django,any good RDBMS(I know only MS- Access) Any job in IT will (well... should) indeed require a decent knowledge of the relational thery / algebra, relational database design (normal forms etc), SQL, and working knowledge with at

Re: Duplicates of third-party libraries

2009-12-08 Thread Martin P. Hellwig
Grant Edwards wrote: cut Does windows even _have_ a library dependancy system that lets an application specify which versions of which libraries it requires? cut Well you could argue that easy_install does it a bit during install. Then there is 'Windows Side By Side' (winsxs) system which sorta

Re: SUB-MATRIX extraction

2009-12-08 Thread Martin P. Hellwig
Jon Clements wrote: On Dec 8, 1:36 pm, Pierre pierre.gaill...@gmail.com wrote: Hello, let b = array([ [0,1,2] , [3,4,5] , [6,7,8] ]) How can I easily extract the submatrix [ [0 ,1], [3, 4]] ? One possiblity is : b[[0,1],:][:,[0,1]] but it is not really easy ! Thanks. x = numpy.array([

Re: relative imports with the __import__ function

2009-12-08 Thread Peter Otten
Chris Colbert wrote: I have package tree that looks like this: main.py package __init__.py configuration.ini server __init__.py xmlrpc_server.py controller.py reco irrelevant.py's segmentation __init__.py

Re: Generators.

2009-12-08 Thread Jorge Cardona
2009/12/8 Lie Ryan lie.1...@gmail.com: First, I apologize for rearranging your message out of order. On 12/8/2009 5:29 AM, Jorge Cardona wrote: islice execute the function at the generator and drop the elements that aren't in the slice. I found that pretty weird, the way that i see

Determine PyArg_ParseTuple parameters at runtime?

2009-12-08 Thread Nikolaus Rath
Hello, I want to create an extension module that provides an interface to a couple of C functions that take arguments of type struct iovec, struct stat, struct flock, etc (the FUSE library, in case it matters). Now the problem is that these structures contain attributes of type fsid_t, off_t,

Re: no module named error

2009-12-08 Thread Joe
Diez B. Roggisch wrote: Joe wrote: But it's searching for _moda.*, most probably a binary extension. Does that exist, and if yes, has it the proper architecture or is it maybe 32 bit? I'm just going by an example script. moda is a package I was given that is written in C and has some

Re: no module named error

2009-12-08 Thread Diez B. Roggisch
Joe wrote: Diez B. Roggisch wrote: Joe wrote: But it's searching for _moda.*, most probably a binary extension. Does that exist, and if yes, has it the proper architecture or is it maybe 32 bit? I'm just going by an example script. moda is a package I was given that is written in C and

Re: In lista infinita?

2009-12-08 Thread Andreas Waldenburger
On Tue, 08 Dec 2009 17:39:13 +0100 andrea andrea.crott...@gmail.com wrote: Ho notato che i generatori anche se infiniti non si lamentano se usati in modo potenzialmente pericoloso. [...] Altri miglioramenti/utilizzi trasversali? Maybe. But I'm sure it.comp.lang.python might help you better.

Re: IO Gurus: what are the differences between these two methods?

2009-12-08 Thread Lie Ryan
On 12/8/2009 4:12 AM, dpapathanasiou wrote: I have two methods for writing binaries files: the first works with data received by a server corresponding to a file upload, and the second works with data sent as email attachments. The odd thing is, they're not interchangeable: if I use the first

Re: no module named error

2009-12-08 Thread Joe
Please verify that it exists and has the proper architecture. Ah, ok, I thought those were one in the same. But I do have that file in another directory elsewhere and I have that directory in my LD_LIBRARY_PATH var. Shouldn't that be enough to do it? --

Re: no module named error

2009-12-08 Thread Joe
Just to clarify, I have _moda.la sitting in another directory which is included in my LD_LIBRARY_PATH. And it is built for the 64bit arch. -- http://mail.python.org/mailman/listinfo/python-list

Re: no module named error

2009-12-08 Thread Diez B. Roggisch
Joe wrote: Just to clarify, I have _moda.la sitting in another directory which is included in my LD_LIBRARY_PATH. And it is built for the 64bit arch. No, the import-mechanism of python doesn't take LD_LIBRARY_PATH into account, and even if it did - _moda.la is a simple archive-file, not a

Re: Brent's variation of a factorization algorithm

2009-12-08 Thread Gabriel Genellina
En Fri, 27 Nov 2009 12:36:29 -0300, n00m n...@narod.ru escribió: Maybe someone'll make use of it: def gcd(x, y): if y == 0: return x return gcd(y, x % y) def brent(n): ... A better place to publish this code would be the Python Cookbook: http://code.activestate.com --

Re: Python3: Sane way to deal with broken encodings

2009-12-08 Thread Martin v. Loewis
Thus my Python script dies a horrible death: File ./update_db, line 67, in module for line in open(tempfile, r): File /usr/local/lib/python3.1/codecs.py, line 300, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf8' codec

Re: Graph library for Python

2009-12-08 Thread geremy condra
On Tue, Dec 8, 2009 at 7:27 AM, Robin Becker ro...@reportlab.com wrote: geremy condra wrote: ... I don't have a problem with adding this if there's a strong desire for it, but at the moment I'm leaning towards a wait-and-see approach, for all the reasons you described. Geremy

Re: Brent's variation of a factorization algorithm

2009-12-08 Thread MRAB
Gabriel Genellina wrote: En Fri, 27 Nov 2009 12:36:29 -0300, n00m n...@narod.ru escribió: Maybe someone'll make use of it: def gcd(x, y): if y == 0: return x return gcd(y, x % y) def brent(n): ... A better place to publish this code would be the Python Cookbook:

Re: can someone explain 'super' to me?

2009-12-08 Thread Gabriel Genellina
En Sat, 05 Dec 2009 07:27:54 -0300, Michael michaelmos...@yahoo.com escribió: From the docs about the built-in function super: super( type[, object-or-type]) Return the superclass of type. [...] You won't get anywhere from the docs in this case,

My Darned Image Again

2009-12-08 Thread Victor Subervi
Hi; I'm having trouble loading my image again. Here's my code: for pic in pics: sql = 'update %s set %s=%s where SKU=%s;' % (store, colNamesPics[i], '%s', sku) sql = sql, (MySQLdb.Binary(pics[int(i)]),) cursor.execute(sql, (MySQLdb.Binary(pics[int(i)]),))

Pyro 3.10 released

2009-12-08 Thread Irmen de Jong
Hi, Pyro 3.10 has been released! Pyro is a an advanced and powerful Distributed Object Technology system written entirely in Python, that is designed to be very easy to use. Have a look at http://pyro.sourceforge.net for more information. Highlights of this release are: - improvements in the

Re: My Darned Image Again

2009-12-08 Thread MRAB
Victor Subervi wrote: Hi; I'm having trouble loading my image again. Here's my code: for pic in pics: sql = 'update %s set %s=%s where SKU=%s;' % (store, colNamesPics[i], '%s', sku) After this, 'sql' will be a string. sql = sql, (MySQLdb.Binary(pics[int(i)]),) After

Problem using commands.getoutput()

2009-12-08 Thread J
Reading up on ways to run commands in a shell and capture output... So I was looking at os.exec*() and that's not the correct thing here. If I understand the docs correctly, the os.exec*() functions actually end the calling program and replace it with the program called by os.exec*() even as far

Re: My Darned Image Again

2009-12-08 Thread Carsten Haese
Victor Subervi wrote: Hi; I'm having trouble loading my image again. Here's my code: for pic in pics: sql = 'update %s set %s=%s where SKU=%s;' % (store, colNamesPics[i], '%s', sku) sql = sql, (MySQLdb.Binary(pics[int(i)]),) cursor.execute(sql,

Re: My Darned Image Again

2009-12-08 Thread Victor Subervi
On Tue, Dec 8, 2009 at 3:28 PM, MRAB pyt...@mrabarnett.plus.com wrote: Victor Subervi wrote: Hi; I'm having trouble loading my image again. Here's my code: for pic in pics: sql = 'update %s set %s=%s where SKU=%s;' % (store, colNamesPics[i], '%s', sku) After this, 'sql'

Re: Problem using commands.getoutput()

2009-12-08 Thread Jerry Hill
On Tue, Dec 8, 2009 at 2:31 PM, J dreadpiratej...@gmail.com wrote: So what's the point of the commands module, or is that one that only works in Linux, and not Windows? At the very top of http://docs.python.org/library/commands.html it says Platforms: Unix, so yes, it's Unix-only. I can do

Re: Problem using commands.getoutput()

2009-12-08 Thread J
On Tue, Dec 8, 2009 at 14:44, Jerry Hill malaclyp...@gmail.com wrote: At the very top of http://docs.python.org/library/commands.html it says Platforms: Unix, so yes, it's Unix-only. That sound you hear is me beating my head against the table now... sigh... I was too wrapped up in reading the

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread Dave Angel
r0g wrote: Dennis Lee Bieber wrote: On Tue, 8 Dec 2009 08:26:58 +0530, 74yrs old withblessi...@gmail.com declaimed the following in gmane.comp.python.general: For Kannada project .txt(not .doc) is used, my requirement is to have one snip In this context, I request you

Re: Does Python mess with the (unicode) code page?

2009-12-08 Thread Gabriel Genellina
En Thu, 03 Dec 2009 15:38:28 -0300, Roy Smith r...@panix.com escribió: We've got a windows executable which used to get run out of a shell script (Cygwin bash) and is now being run with subprocess.Popen(). The windows app is misbehaving. To make a long story short, the guy who wrote the

Re: My Darned Image Again

2009-12-08 Thread Carsten Haese
Victor Subervi wrote: I don't know what happened, but when I pulled that out, it threw a familiar error that alerted me to quote the last variable (SKU=%s) and the blob went straight in. Thanks! The fact that you had to quote the SKU value indicates to me that it's an alphanumeric value (or

Re: Exception classes don't follow pickle protocol, problems unpickling

2009-12-08 Thread Irmen de Jong
On 7-12-2009 10:12, Peter Otten wrote: So there are 2 problems: the pickle protocol isn't used when exception objects (or instances of classes derived from Exception) are pickled, and during unpickling, it then crashes because it calls __init__ with the wrong amount of parameters. (why is it

Trying to set up dictionary to map to functions

2009-12-08 Thread Randy Belt
Hi, I have a small test program written trying to set up a dictionary that points keys to functions. It is working. However, in the process of creating it I noticed a weird problem. The problem is that this IS WORKING and I think it shouldn't be. ~ Here is the input config file code ~ its

Re: Fwd: Request for solution

2009-12-08 Thread Gabriel Genellina
En Mon, 07 Dec 2009 21:59:42 -0300, 74yrs old withblessi...@gmail.com escribió: For Kannada project .txt(not .doc) is used, my requirement is to have one space between two characters in Notepad file. In MSword there is provision to make space between two characters under Font and can be

Re: Graph library for Python

2009-12-08 Thread Carl Banks
On Dec 8, 4:27 am, Robin Becker ro...@reportlab.com wrote: Is there reason to suppose that any one representation of graphs or digraphs is so good we need to add it to python? One of them bothered to write a PEP proposing its inclusion? Even for fairly common algorithms eg Dijkstra's

Re: hola

2009-12-08 Thread Gabriel Genellina
En Sun, 06 Dec 2009 19:48:28 -0300, Chris Rebert c...@rebertia.com escribió: 2009/12/6 franki fuentes cueto ffrankis...@gmail.com: hola soy un pequeño programador y quiesiera pedirles ayuda para programar en python, no se si me podrian mandar ejemplos para poder empezar, y como terminarlo

Re: Trying to set up dictionary to map to functions

2009-12-08 Thread Peter Otten
Randy Belt wrote: I have a small test program written trying to set up a dictionary that points keys to functions. It is working. However, in the process of creating it I noticed a weird problem. The problem is that this IS WORKING and I think it shouldn't be. ~ Here is the input config

Re: hola

2009-12-08 Thread Gabriel Genellina
En Sun, 06 Dec 2009 19:48:28 -0300, Chris Rebert c...@rebertia.com escribió: 2009/12/6 franki fuentes cueto ffrankis...@gmail.com: hola soy un pequeño programador y quiesiera pedirles ayuda para programar en python, no se si me podrian mandar ejemplos para poder empezar, y como terminarlo

Re: Trying to set up dictionary to map to functions

2009-12-08 Thread Dave Angel
Randy Belt wrote: Hi, I have a small test program written trying to set up a dictionary that points keys to functions. It is working. However, in the process of creating it I noticed a weird problem. The problem is that this IS WORKING and I think it shouldn't be. ~ Here is the input config

Re: How to create a docstring for a module?

2009-12-08 Thread Gabriel Genellina
En Sun, 06 Dec 2009 23:51:30 -0300, alex23 wuwe...@gmail.com escribió: Phillip M. Feldman pfeld...@verizon.net wrote: It does seem as though IPython could be a bit more clever about this. I disagree. I _like_ that IPython is only reporting on the current state of the interpreter and not

Re: Graph library for Python

2009-12-08 Thread Rhodri James
On Tue, 08 Dec 2009 04:28:05 -, geremy condra debat...@gmail.com wrote: On Mon, Dec 7, 2009 at 6:28 PM, M.-A. Lemburg m...@egenix.com wrote: I wasn't thinking of anything clever :-) ... g = Graph( [Node(a), Node(b), Node(c)], [Edge(Node(a), Node(b), ab), Edge(Node(a),

switch

2009-12-08 Thread hong zhang
List, Python does not have switch statement. Any other option does similar work? Thanks for help. --henry -- http://mail.python.org/mailman/listinfo/python-list

Re: switch

2009-12-08 Thread Chris Rebert
On Tue, Dec 8, 2009 at 5:53 PM, hong zhang henryzhan...@yahoo.com wrote: Python does not have switch statement. Any other option does similar work? Yes, a dictionary with functions as values: http://simonwillison.net/2004/May/7/switch/ Cheers, Chris -- http://blog.rebertia.com --

Re: Generators.

2009-12-08 Thread Lie Ryan
On 12/9/2009 3:52 AM, Jorge Cardona wrote: 2009/12/8 Lie Ryanlie.1...@gmail.com: First, I apologize for rearranging your message out of order. Theoretically yes, but the semantic of generators in python is they work on an Iterable (i.e. objects that have __iter__), instead of a Sequence (i.e..

Re: switch

2009-12-08 Thread Benjamin Kaplan
On Tue, Dec 8, 2009 at 8:53 PM, hong zhang henryzhan...@yahoo.com wrote: List, Python does not have switch statement. Any other option does similar work? Thanks for help. Use a dict instead, where the keys are the different cases and the values are usually callable objects (such as

Re: switch

2009-12-08 Thread rzzzwilson
On Dec 9, 1:00 pm, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Tue, Dec 8, 2009 at 8:53 PM, hong zhang henryzhan...@yahoo.com wrote: List, Python does not have switch statement. Any other option does similar work? Thanks for help. Use a dict instead, where the keys are the

Re: switch

2009-12-08 Thread zeph
Even better (well, shorter!): options = {a : do_a, b,do_b, c, do_c} options.get(option, do_default)() You can also make it something callable like so, which is a little more compact if you need to reuse it a lot: def do_a(x): print a:, x ... def do_b(x): print b:, x ... def do_c(x):

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread r0g
Dave Angel wrote: r0g wrote: Dennis Lee Bieber wrote: On Tue, 8 Dec 2009 08:26:58 +0530, 74yrs old withblessi...@gmail.com declaimed the following in gmane.comp.python.general: For Kannada project .txt(not .doc) is used, my requirement is to have one snip In this

Re: Graph library for Python

2009-12-08 Thread geremy condra
On Tue, Dec 8, 2009 at 8:42 PM, Rhodri James rho...@wildebst.demon.co.uk wrote: On Tue, 08 Dec 2009 04:28:05 -, geremy condra debat...@gmail.com wrote: On Mon, Dec 7, 2009 at 6:28 PM, M.-A. Lemburg m...@egenix.com wrote: I wasn't thinking of anything clever :-) ... g = Graph(    

Re: switch

2009-12-08 Thread Kee Nethery
I string together a bunch of elif statements to simulate a switch if foo == True: blah elif bar == True: blah blah elif bar == False: blarg elif -- http://mail.python.org/mailman/listinfo/python-list

Re: switch

2009-12-08 Thread Asun Friere
On Dec 9, 4:02 pm, Kee Nethery k...@kagi.com wrote: I string together a bunch of elif statements to simulate a switch if foo == True:         blah elif bar == True:         blah blah elif bar == False:         blarg elif This code is probably symptomatic of poor design. (Not to

Re: Brent's variation of a factorization algorithm

2009-12-08 Thread Gabriel Genellina
En Tue, 08 Dec 2009 15:51:29 -0300, MRAB pyt...@mrabarnett.plus.com escribió: Gabriel Genellina wrote: En Fri, 27 Nov 2009 12:36:29 -0300, n00m n...@narod.ru escribió: def gcd(x, y): if y == 0: return x return gcd(y, x % y) def brent(n): ... A better place to publish this

Re: switch

2009-12-08 Thread Steven D'Aprano
On Tue, 08 Dec 2009 21:02:44 -0800, Kee Nethery wrote: I string together a bunch of elif statements to simulate a switch if foo == True: blah elif bar == True: blah blah elif bar == False: blarg elif Are you sure you want to test for equality with True and

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread Dave Angel
r0g wrote: Dave Angel wrote: r0g wrote: Dennis Lee Bieber wrote: On Tue, 8 Dec 2009 08:26:58 +0530, 74yrs old withblessi...@gmail.com declaimed the following in gmane.comp.python.general: For Kannada project .txt(not .doc) is used, my requirement is to have one

Re: switch

2009-12-08 Thread Steven D'Aprano
On Tue, 08 Dec 2009 21:36:23 -0800, Asun Friere wrote: On Dec 9, 4:02 pm, Kee Nethery k...@kagi.com wrote: I string together a bunch of elif statements to simulate a switch if foo == True:         blah elif bar == True:         blah blah elif bar == False:         blarg elif

Re: switch

2009-12-08 Thread Asun Friere
On Dec 9, 5:12 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 08 Dec 2009 21:02:44 -0800, Kee Nethery wrote: I string together a bunch of elif statements to simulate a switch if foo == True:    blah elif bar == True:    blah blah elif bar == False:    

Re: python bijection

2009-12-08 Thread Gabriel Genellina
En Sat, 28 Nov 2009 06:30:44 -0300, Joshua Bronson jabron...@gmail.com escribió: On Nov 27, 9:36 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Fri, 27 Nov 2009 15:12:36 -0300, Francis Carr coldtort...@gmail.com escribió: After much tinkering, I think I have a simpler solution.

Re: Request for py program to insert space between two characters and saved as text?

2009-12-08 Thread r0g
Dave Angel wrote: r0g wrote: Dave Angel wrote: r0g wrote: Dennis Lee Bieber wrote: On Tue, 8 Dec 2009 08:26:58 +0530, 74yrs old withblessi...@gmail.com declaimed the following in gmane.comp.python.general: For Kannada project .txt(not .doc) is used, my

[issue7457] Adding a read_pkg_file to DistributionMetadata

2009-12-08 Thread Tarek Ziadé
New submission from Tarek Ziadé ziade.ta...@gmail.com: This API will allow readong back static PKG-INFO files. -- assignee: tarek components: Distutils messages: 96113 nosy: tarek priority: normal severity: normal status: open title: Adding a read_pkg_file to DistributionMetadata

[issue7452] Invalid mnemonic 'fnstcw'

2009-12-08 Thread Ned Deily
Ned Deily n...@acm.org added the comment: Works for me on 10.4.11 PPC (G3) machine rather than Intel (which shouldn't make a difference). But from your config.log, the gcc version is older than what I have on 10.4 (build 5250 vs build 5370). Suggest ensuring you have the most recent Xcode

[issue7456] rfc822.Message.getheaders undocumented

2009-12-08 Thread Tarek Ziadé
Tarek Ziadé ziade.ta...@gmail.com added the comment: Forget about this, I have realized this module is deprecated in python 3. -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7456

[issue7457] Adding a read_pkg_file to DistributionMetadata

2009-12-08 Thread Tarek Ziadé
Tarek Ziadé ziade.ta...@gmail.com added the comment: done in r76702 + r76704 (2.7) and r76706 (3.2) -- status: open - closed versions: -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7457

[issue7458] crash in str.find() and str.rfind() with invalid start value

2009-12-08 Thread STINNER Victor
New submission from STINNER Victor victor.stin...@haypocalc.com: str.find() and str.rfind() reads non initialized memory (using memcmp()) if start is bigger than end. Attached patch fixes the issue and includes a patch. -- components: Interpreter Core messages: 96117 nosy: haypo

[issue7458] crash in str.find() and str.rfind() with invalid start value

2009-12-08 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: -- keywords: +patch Added file: http://bugs.python.org/file15492/str_find.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7458 ___

[issue7458] crash in str.find() and str.rfind() with invalid start value

2009-12-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: In my test, start=6287518193 is an arbitrary value, it may crash or not. The test might use any random integer 0. -- ___ Python tracker rep...@bugs.python.org

[issue7458] crash in str.find() and str.rfind() with invalid start value

2009-12-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: The bug was introduced in Python 2.5 during the needforspeed sprint: r46469 (May 27 2006). http://wiki.python.org/moin/NeedForSpeed Python 2.5 is not affected, Python 3.x is affected. CRASH_rfind.py is more stable and should

[issue7458] crash in str.find() and str.rfind() with invalid start value

2009-12-08 Thread flox
flox la...@yahoo.fr added the comment: This bug does not occur on Debian 64 bits. ~ $ uname -srvm Linux 2.6.30-bpo.1-amd64 #1 SMP Mon Aug 17 08:42:50 UTC 2009 x86_64 Tested with variants: from random import getrandbits self.checkequal(-1, 'ab', 'find', 'xxx', getrandbits(64),

  1   2   >