[ANN] Next meeting of pyCologne, December, 9th

2009-12-07 Thread Thomas Lenarz
The next meeting of pyCologne (Cologne, Germany) will take place Wednesday, December, 9th starting about 6.30 pm - 6.45 pm at Room 0.14, Benutzerrechenzentrum (RRZK-B) University of Cologne, Berrenrather Str. 136, 50937 Köln, Germany This time we haven't got a fixed agenda yet. We will probably

Re: python proxy checker ,change to threaded version

2009-12-07 Thread r0g
elca wrote: Hello ALL, i have some python proxy checker . and to speed up check, i was decided change to mutlthreaded version, and thread module is first for me, i was tried several times to convert to thread version and look for many info, but it not so much easy for novice python

Re: What is the significance of after() in this code?

2009-12-07 Thread Martin P. Hellwig
W. eWatson wrote: See Subject. def StackImages(self): self.Upload(P) self.after_id = self.master.after(1,self.GetFrameOne) If you are talking tkinter here, it is an alarm callback. See http://effbot.org/tkinterbook/widget.htm -- MPH http://blog.dcuktec.com 'If

Re: python proxy checker ,change to threaded version

2009-12-07 Thread elca
r0g wrote: elca wrote: Hello ALL, i have some python proxy checker . and to speed up check, i was decided change to mutlthreaded version, and thread module is first for me, i was tried several times to convert to thread version and look for many info, but it not so much easy

Re: Float precision and float equality

2009-12-07 Thread Steven D'Aprano
On Sun, 06 Dec 2009 14:54:37 -0800, Carl Banks wrote: (I remember once struggling in a homework assignment over seemingly large discrepancies in a calculation I was doing, until i realized that the actual numbers were on the scale of 10**11, and the difference was around 10**1, so it really

Re: how to convert string function to string method?

2009-12-07 Thread Peter Otten
Dr. Phillip M. Feldman wrote: I wrote a handy-dandy function (see below) called strip_pairs for stripping matching pairs of characters from the beginning and end of a string. This function works, but I would like to be able to invoke it as a string method rather than as a function. Is

Re: how to convert string function to string method?

2009-12-07 Thread r0g
Dr. Phillip M. Feldman wrote: I wrote a handy-dandy function (see below) called strip_pairs for stripping matching pairs of characters from the beginning and end of a string. This function works, but I would like to be able to invoke it as a string method rather than as a function. Is this

dict.fromkeys strange behavior

2009-12-07 Thread Tsviki Hirsh
Dear list, I'm trying to create a dictionary from set of keys and values using dict.fromkeys When I type: dict.fromkeys('a',50) the output is: {'a': 50} This is fine, but when I try to set the same value to a different name key: dict.fromkeys('at',50) the output now is: {'a': 50, 't': 50}

Re: how to convert string function to string method?

2009-12-07 Thread Bruno Desthuilliers
Dr. Phillip M. Feldman a écrit : I wrote a handy-dandy function (see below) called strip_pairs for stripping matching pairs of characters from the beginning and end of a string. This function works, but I would like to be able to invoke it as a string method rather than as a function. Is this

Re: how to convert string function to string method?

2009-12-07 Thread Steven D'Aprano
On Sun, 06 Dec 2009 22:47:48 -0800, Dr. Phillip M. Feldman wrote: I wrote a handy-dandy function (see below) called strip_pairs for stripping matching pairs of characters from the beginning and end of a string. This function works, but I would like to be able to invoke it as a string method

Re: dict.fromkeys strange behavior

2009-12-07 Thread Chris Rebert
On Mon, Dec 7, 2009 at 12:42 AM, Tsviki Hirsh tsviki.hi...@gmail.com wrote: Dear list, I'm trying to create a dictionary from set of keys and values using dict.fromkeys When I type: dict.fromkeys('a',50) the output is: {'a': 50} This is fine, but when I try to set the same value to a

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

2009-12-07 Thread Peter Otten
Irmen de Jong wrote: I am puzzled why Python's exception classes don't seem to follow the pickle protocol. To be more specific: an instance of a user defined exception, subclassed from Exception, cannot be pickled/unpickled correctly in the expected way. The pickle protocol says that:

Re: subprocess kill

2009-12-07 Thread Jean-Michel Pichavant
luca72 wrote: On 5 Dic, 03:06, Carl Banks pavlovevide...@gmail.com wrote: On Dec 4, 3:44 pm, luca72 lucabe...@libero.it wrote: On 5 Dic, 00:14, luca72 lucabe...@libero.it wrote: On 5 Dic, 00:03, luca72 lucabe...@libero.it wrote: On 4 Dic, 23:23, Mike Driscoll

unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Victor Subervi
Hi; I get the following error: /var/www/html/angrynates.com/cart/createCats2.py 111 /form 112 /body/html 113 ''' 114 115 createCats2() createCats2 = function createCats2 /var/www/html/angrynates.com/cart/createCats2.py in createCats2() 85 for standAloneStore in

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Xavier Ho
Hi Victor, the .append function doesn't return anything, so it's a None. And you should have it inside the parentheses. tree.append(%s%s % (\t * level, name)) is probably what you're after. Cheers, Xav -- http://mail.python.org/mailman/listinfo/python-list

Re: how to convert string function to string method?

2009-12-07 Thread Bruno Desthuilliers
r0g a écrit : (snip) I've never tried it but I think it is possible to inject new methods into existing classes, see... Doesn't work for most builtin types - for both performances and sanity reasons. -- http://mail.python.org/mailman/listinfo/python-list

Two questions ( Oracle and modules )

2009-12-07 Thread Gabor Urban
Hi guys, I have two questions. 1. I have choice to introduce Python to my new employee. We are to write and application that uses databases stored partially in Oracle 10 and partially in Oracle 11. We have to execute standard SQL commands and stored procedures as well. Which is best conection /

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Jean-Michel Pichavant
Victor Subervi wrote: global printTree = function printTree, allTrees = [{'prodCat1': {}, 'prodCat2': {}}, {'presCat1': {}, 'presCat2': {}}] /var/www/html/angrynates.com/cart/catTree.py http://angrynates.com/cart/catTree.py in printTree(allTrees=[{'prodCat1': {}, 'prodCat2': {}},

Re: What is the significance of after() in this code?

2009-12-07 Thread W. eWatson
Martin P. Hellwig wrote: W. eWatson wrote: See Subject. def StackImages(self): self.Upload(P) self.after_id = self.master.after(1,self.GetFrameOne) If you are talking tkinter here, it is an alarm callback. See http://effbot.org/tkinterbook/widget.htm Very good. I

Re: High-performance Python websites

2009-12-07 Thread Dr. Marco
On Wed, 25 Nov 2009 21:21:25 -0800 (PST), Nick Mellor nick.mellor.gro...@pobox.com wrote : Hi, I wasn't aware that Google used Python for running their Google groups servers. Can you confirm that? The only place I've seen Google explicitly use Python on their web front end is in the Google

Re: hola

2009-12-07 Thread Chris Rebert
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 para que se ejecute, me entiendes , aver sime ayudan gracias Esta lista de

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

2009-12-07 Thread Mensanator
On Dec 5, 11:38�pm, W. eWatson wolftra...@invalid.com 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

Re: semantics of ** (unexpected/inconsistent?)

2009-12-07 Thread Albert van der Horst
In article 87eingrbh9@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: Lie Ryan lie.1...@gmail.com writes: I generally do not expect operator precedence to be reliable at all Have another read of the thread. The OP's confusion was not over operator precedence, but over how

postgresql_autodoc in Python?

2009-12-07 Thread Wolfgang Keller
Hello, has anyone ever implemented something similar to postgresql_autodoc in Python? TIA, Sincerely, Wolfgang -- NO Courtesy Copies PLEASE! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to timeout when waiting for raw_input from user ?

2009-12-07 Thread Rune Strand
On Dec 5, 3:42 pm, Maxim Khitrov mkhit...@gmail.com wrote: I'm not talking about the Timer, I'm talking about the original question. There's nothing (that I know of) you can do with a Timer on Windows to interrupt a raw_input call. That is true. But if the issue here is to present a question,

Re: Organization of GUIs

2009-12-07 Thread Michael
On Dec 5, 11:50 pm, zeph zep...@gmail.com wrote: I highly recommend reading the Cocoa documentation, which has volumes on all sorts of things like this.  Here's a link that talks about views in that context, and should give you more ideas about well- designed GUI layouts:http://bit.ly/6b8PYh

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-07 Thread John Machin
On Dec 5, 9:57 pm, W. eWatson wolftra...@invalid.com wrote: [snip]          s = self.current_path s referred to something ...          s = Analysis but now s refers to Analysis ... at best, there is redundant confusing code; at worst, the source of your problem.          s =

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

2009-12-07 Thread W. eWatson
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: Why Doesn't XP Pro Show Size, Time and Date Mod of a Created File?

2009-12-07 Thread W. eWatson
Mensanator wrote: On Dec 5, 11:38�pm, W. eWatson wolftra...@invalid.com 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

Re: Are routine objects guaranteed mutable with dictionary?

2009-12-07 Thread Duncan Booth
Alf P. Steinbach al...@start.no wrote: The question is what guarantees or absence thereof the language specification, PEPs, intentions, whatever gives/has. See the documentation: http://docs.python.org/3.1/reference/datamodel.html BTW, it's a function, not a routine Wikipedia is your

Re: python bijection

2009-12-07 Thread M.-A. Lemburg
Terry Reedy wrote: M.-A. Lemburg wrote: Integrating an easy-to-use graph library into the collections module (and it's C companion) is good idea. This would have to be written in C, though, That's currently in the works, along with database backing. We'd welcome any help though... hint,

Re: Two questions ( Oracle and modules )

2009-12-07 Thread Michael Crute
On Mon, Dec 7, 2009 at 6:57 AM, Gabor Urban urbang...@gmail.com wrote: 1. I have choice to introduce Python to my new employee. We are to write and application that uses databases stored partially in Oracle 10 and partially in Oracle 11. We have to execute standard SQL commands and stored

Re: python bijection

2009-12-07 Thread M.-A. Lemburg
Carl Banks wrote: On Dec 4, 4:42 pm, Lie Ryan lie.1...@gmail.com wrote: On 12/5/2009 9:41 AM, Carl Banks wrote: On Dec 4, 12:46 pm, geremy condradebat...@gmail.com wrote: more common than full-blown graph package). Sure, its a tree, which is also a graph. In this case it looks to me

Re: What is the significance of after() in this code?

2009-12-07 Thread Neil Cerutti
On 2009-12-07, W. eWatson wolftra...@invalid.com wrote: See Subject. def StackImages(self): self.Upload(P) self.after_id = self.master.after(1,self.GetFrameOne) It's a violation of the Law of Demeter. -- Neil Cerutti --

Re: Float precision and float equality

2009-12-07 Thread Mark Dickinson
On Dec 6, 7:34 pm, Anton81 gerenu...@googlemail.com wrote: I do some linear algebra and whenever the prefactor of a vector turns out to be zero, I want to remove it. Hmm. Comparing against zero is something of a special case. So you'd almost certainly be doing an 'if abs(x) tol: ...' check,

Re: What is the significance of after() in this code?

2009-12-07 Thread Neil Cerutti
On 2009-12-07, Neil Cerutti ne...@norwich.edu wrote: On 2009-12-07, W. eWatson wolftra...@invalid.com wrote: See Subject. def StackImages(self): self.Upload(P) self.after_id = self.master.after(1,self.GetFrameOne) It's a violation of the Law of Demeter. Actually,

Re: Float precision and float equality

2009-12-07 Thread Mark Dickinson
On Dec 7, 12:16 am, David Cournapeau courn...@gmail.com wrote: If you can depend on IEEE 754 semantics, one relatively robust method is to use the number of representable floats between two numbers. The main advantage compared to the proposed methods is that it somewhat automatically takes

Re: postgresql_autodoc in Python?

2009-12-07 Thread Simon Brunning
2009/12/6 Wolfgang Keller felip...@gmx.net: Hello, has anyone ever implemented something similar to postgresql_autodoc in Python? Dunno - what is it? -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Victor Subervi
On Mon, Dec 7, 2009 at 7:14 AM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Victor Subervi wrote: global printTree = function printTree, allTrees = [{'prodCat1': {}, 'prodCat2': {}}, {'presCat1': {}, 'presCat2': {}}] /var/www/html/angrynates.com/cart/catTree.py

Re: postgresql_autodoc in Python?

2009-12-07 Thread Jean-Michel Pichavant
Wolfgang Keller wrote: Hello, has anyone ever implemented something similar to postgresql_autodoc in Python? TIA, Sincerely, Wolfgang If by postgresql_autodoc you mean tools for generating html documentation from python code, yes. Starting from the ugliest: - pydoc - epydoc - sphinx

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Jean-Michel Pichavant
Victor Subervi wrote: On Mon, Dec 7, 2009 at 7:14 AM, Jean-Michel Pichavant jeanmic...@sequans.com mailto:jeanmic...@sequans.com wrote: Victor Subervi wrote: global printTree = function printTree, allTrees = [{'prodCat1': {}, 'prodCat2': {}}, {'presCat1': {},

Re: postgresql_autodoc in Python?

2009-12-07 Thread Tino Wildenhain
Am 07.12.2009 15:14, schrieb Jean-Michel Pichavant: Wolfgang Keller wrote: Hello, has anyone ever implemented something similar to postgresql_autodoc in Python? TIA, Sincerely, Wolfgang If by postgresql_autodoc you mean tools for generating html documentation from python code, yes.

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Victor Subervi
On Mon, Dec 7, 2009 at 9:36 AM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Victor Subervi wrote: On Mon, Dec 7, 2009 at 7:14 AM, Jean-Michel Pichavant jeanmic...@sequans.com mailto:jeanmic...@sequans.com wrote: Victor Subervi wrote: global printTree = function

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Jean-Michel Pichavant
Victor Subervi wrote: printTree(aTree[name], level + 1) ... print aTree([name], level + 1) ... Traceback (most recent call last): File stdin, line 4, in ? TypeError: 'dict' object is not callable Be cautious, you are now executing the same code ! Again, read carefully

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Carsten Haese
Victor Subervi wrote: I'll do my best to remember to do that from now on to: allTrees = [{'prodCat1': {}, 'prodCat2': {}}, {'presCat1': {}, 'presCat2': {}}] level = 0 tree = [] for aTree in allTrees: ... for name in sorted(aTree.keys()): ... tree.append(%s%s % (\t * level, name))

opening a connection to quickbooks

2009-12-07 Thread jfabiani
Hi, Has anyone ever attempted to work with quickbooks in a real time fashion? I need some advise. I'm trying to work out a way to have real time updates/inserts/and queries. I'd also like not to use all the user licenses. But... I have discovered that opening a connection to quickbooks takes a

Re: When will Python 3 be fully deployed

2009-12-07 Thread vsoler
On Dec 6, 11:53 pm, Martin P. Hellwig martin.hell...@dcuktec.org wrote: Edward A. Falk wrote: cut For development purposes, you should stick with the oldest version that will actually run your code.  Every time you move to a more modern version, you're leaving potential

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Victor Subervi
On Mon, Dec 7, 2009 at 11:29 AM, Carsten Haese carsten.ha...@gmail.comwrote: Victor Subervi wrote: I'll do my best to remember to do that from now on to: allTrees = [{'prodCat1': {}, 'prodCat2': {}}, {'presCat1': {}, 'presCat2': {}}] level = 0 tree = [] for aTree in allTrees:

Where is my namespace?

2009-12-07 Thread vsoler
I take the example from Mark Lutz's excellent book Learning Python. *** In nested1.py I have: X=99 def printer(): print X *** In nested2.py I have: from nested1 import X, printer X=88 printer() What is amazing is that running nested2.py prints 99 and not 88. My questions are: 1. Using

Re: Where is my namespace?

2009-12-07 Thread Simon Brunning
2009/12/7 vsoler vicente.so...@gmail.com: I take the example from Mark Lutz's excellent book Learning Python. *** In nested1.py  I have: X=99 def printer(): print X *** In nested2.py  I have: from nested1 import X, printer X=88 printer() What is amazing is that running nested2.py

Re: Where is my namespace?

2009-12-07 Thread Benjamin Kaplan
On Mon, Dec 7, 2009 at 11:10 AM, vsoler vicente.so...@gmail.com wrote: I take the example from Mark Lutz's excellent book Learning Python. *** In nested1.py  I have: X=99 def printer(): print X *** In nested2.py  I have: from nested1 import X, printer X=88 printer() What is amazing is

Re: Where is my namespace?

2009-12-07 Thread Bruno Desthuilliers
vsoler a écrit : I take the example from Mark Lutz's excellent book Learning Python. *** In nested1.py I have: X=99 def printer(): print X *** In nested2.py I have: from nested1 import X, printer X=88 printer() What is amazing is that running nested2.py prints 99 and not 88. It's amazing

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Rami Chowdhury
On Mon, Dec 7, 2009 at 08:01, Victor Subervi victorsube...@gmail.com wrote: On Mon, Dec 7, 2009 at 11:29 AM, Carsten Haese carsten.ha...@gmail.com wrote: Victor Subervi wrote: I'll do my best to remember to do that from now on to: allTrees = [{'prodCat1': {}, 'prodCat2': {}},

Re: python bijection

2009-12-07 Thread geremy condra
On Mon, Dec 7, 2009 at 7:51 AM, M.-A. Lemburg m...@egenix.com wrote: Terry Reedy wrote: M.-A. Lemburg wrote: Integrating an easy-to-use graph library into the collections module (and it's C companion) is good idea. This would have to be written in C, though, That's currently in the works,

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Carsten Haese
Victor Subervi wrote: Well, if you could point me in the right direction, it would be appreciated. I've tried googling this with no luck. Apparently, expand is not a well-documented term in python and, of course, it's an often-used term in English, which further confuses the issue. Yes, I

Re: python bijection

2009-12-07 Thread M.-A. Lemburg
geremy condra wrote: On Mon, Dec 7, 2009 at 7:51 AM, M.-A. Lemburg m...@egenix.com wrote: Terry Reedy wrote: M.-A. Lemburg wrote: Integrating an easy-to-use graph library into the collections module (and it's C companion) is good idea. This would have to be written in C, though, That's

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Victor Subervi
On Mon, Dec 7, 2009 at 12:40 PM, Rami Chowdhury rami.chowdh...@gmail.comwrote: Coming from PHP, Wash your mouth out with soap, Rami! I might not be a good programmer, but I'm loyal to the Flying Circus. I only did one job, my first one, in PHP before I became enlightened :)) I can see why

Re: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2009-12-07 Thread Victor Subervi
On Mon, Dec 7, 2009 at 12:52 PM, Carsten Haese carsten.ha...@gmail.comwrote: Victor Subervi wrote: Well, if you could point me in the right direction, it would be appreciated. I've tried googling this with no luck. Apparently, expand is not a well-documented term in python and, of course,

Re: python bijection

2009-12-07 Thread geremy condra
On Mon, Dec 7, 2009 at 12:05 PM, M.-A. Lemburg m...@egenix.com wrote: geremy condra wrote: On Mon, Dec 7, 2009 at 7:51 AM, M.-A. Lemburg m...@egenix.com wrote: Terry Reedy wrote: M.-A. Lemburg wrote: Integrating an easy-to-use graph library into the collections module (and it's C companion)

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

2009-12-07 Thread dpapathanasiou
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 one to saved data parsed from an email

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

2009-12-07 Thread Joe Riopel
On Mon, Dec 7, 2009 at 12:12 PM, dpapathanasiou denis.papathanas...@gmail.com 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,

Re: how to convert string function to string method?

2009-12-07 Thread Terry Reedy
Steven D'Aprano wrote: On Sun, 06 Dec 2009 22:47:48 -0800, Dr. Phillip M. Feldman wrote: I wrote a handy-dandy function (see below) called strip_pairs for stripping matching pairs of characters from the beginning and end of a string. This function works, but I would like to be able to invoke

Re: python proxy checker ,change to threaded version

2009-12-07 Thread Terry Reedy
r0g wrote: The trick to threads is to create a subclass of threading.Thread, define the 'run' function and call the 'start()' method. I find threading quite generally useful so I created this simple generic function for running things in threads... Great idea. Thanks for posting this. def

Re: Generators.

2009-12-07 Thread Jorge Cardona
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 elements were computed in a diferent core of my machine. I start using islice function in order to split the job

Re: Python3: Sane way to deal with broken encodings

2009-12-07 Thread Johannes Bauer
Bruno Desthuilliers schrieb: Is that possible? If so, how? This might get you started: help(str.decode) decode(...) S.decode([encoding[,errors]]) - object Hmm, this would work nicely if I called decode explicitly - but what I'm doing is: #!/usr/bin/python3 for line in

Re: Python3: Sane way to deal with broken encodings

2009-12-07 Thread Benjamin Kaplan
On Mon, Dec 7, 2009 at 2:16 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: Bruno Desthuilliers schrieb: Is that possible? If so, how? This might get you started: help(str.decode) decode(...)     S.decode([encoding[,errors]]) - object Hmm, this would work nicely if I called decode

unittest buffing output on windows?

2009-12-07 Thread Roy Smith
I'm running 2.5.1. I've got a test suite that takes about 15 minutes to complete. On my unix boxes, as each test case executes, it prints out a line (I'm using unittest.TextTestRunner(verbosity=2)) of status, but on my windows box (running under cygwin), it buffers everything until the entire

Re: Where is my namespace?

2009-12-07 Thread vsoler
On Dec 7, 5:39 pm, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Mon, Dec 7, 2009 at 11:10 AM, vsoler vicente.so...@gmail.com wrote: I take the example from Mark Lutz's excellent book Learning Python. *** In nested1.py  I have: X=99 def printer(): print X *** In nested2.py  I

Graph library for Python (was: Re: python bijection)

2009-12-07 Thread M.-A. Lemburg
geremy condra wrote: How interested are you in a C port of graphine? I haven't had any specific requests for it, but if its something you need I can shuffle it towards the top of the to do pile. There are two main reasons for a C implementation: 1. performance 2. memory footprint These

Re: dict.fromkeys strange behavior

2009-12-07 Thread Terry Reedy
Tsviki Hirsh wrote: dict.fromkeys('at',50) {'a': 50, 't': 50} This is obviously not what I wanted. Not obvious at all. It is precisely what you asked for ;-) Please read the doc: 5.8. Mapping Types — dict classmethod fromkeys(seq[, value]) Create a new dictionary with keys from seq and

Re: Two questions ( Oracle and modules )

2009-12-07 Thread Terry Reedy
Gabor Urban wrote: Hi guys, 2. We have tp write a module that will be imported a couple of places. Though we must be sure, this module's initialization is performed only once. How can we implement this? I do not know what to google for. There are two ways to have one file executed twice

Re: unittest buffing output on windows?

2009-12-07 Thread Dave Angel
Roy Smith wrote: I'm running 2.5.1. I've got a test suite that takes about 15 minutes to complete. On my unix boxes, as each test case executes, it prints out a line (I'm using unittest.TextTestRunner(verbosity=2)) of status, but on my windows box (running under cygwin), it buffers everything

question about imports in a class

2009-12-07 Thread J
Just a little newbie confusion about OS imports... Why does this give me an error: class Windows: def __init__(self): ''' Constructor ''' import os self.dmidecodePath= #final path to dmidecode binary def parseDMI(self): # First, find

Re: python proxy checker ,change to threaded version

2009-12-07 Thread Rhodri James
On Mon, 07 Dec 2009 18:21:23 -, Terry Reedy tjre...@udel.edu wrote: r0g wrote: The trick to threads is to create a subclass of threading.Thread, define the 'run' function and call the 'start()' method. I find threading quite generally useful so I created this simple generic function for

Re: question about imports in a class

2009-12-07 Thread Diez B. Roggisch
J schrieb: Just a little newbie confusion about OS imports... Why does this give me an error: class Windows: def __init__(self): ''' Constructor ''' import os self.dmidecodePath= #final path to dmidecode binary def parseDMI(self): #

Re: question about imports in a class

2009-12-07 Thread J
On Mon, Dec 7, 2009 at 16:13, J dreadpiratej...@gmail.com wrote: But why does importing in the init not make os available to every other function in the class?  Do I have to import OS into every function like this: class ClassA():    def func1(self):        import os    def func2(self):

Re: question about imports in a class

2009-12-07 Thread Diez B. Roggisch
J schrieb: On Mon, Dec 7, 2009 at 16:13, J dreadpiratej...@gmail.com wrote: But why does importing in the init not make os available to every other function in the class? Do I have to import OS into every function like this: class ClassA(): def func1(self): import os def

Re: question about imports in a class

2009-12-07 Thread Rhodri James
On Mon, 07 Dec 2009 21:13:25 -, J dreadpiratej...@gmail.com wrote: Just a little newbie confusion about OS imports... Why does this give me an error: It's generally helpful to say *what* error you get, including the traceback. Fortunately the source code is enough this time. class

Re: question about imports in a class

2009-12-07 Thread J
On Mon, Dec 7, 2009 at 16:57, Diez B. Roggisch de...@nospam.web.de wrote: if I put the import at the beginning of the class, it just dawned on me that perhaps I still have to explicitly call the function by class: sysinfo.py class myclass():    import os    def findDMIDecode(self):      

Re: python proxy checker ,change to threaded version

2009-12-07 Thread Terry Reedy
Rhodri James wrote: On Mon, 07 Dec 2009 18:21:23 -, Terry Reedy tjre...@udel.edu 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:

Re: Where is my namespace?

2009-12-07 Thread Steven D'Aprano
On Mon, 07 Dec 2009 16:25:39 +, Simon Brunning wrote: 2009/12/7 vsoler vicente.so...@gmail.com: [...] If you do from blah import the imported module itself isn't bound to any name in the importing module - you can't get at it at all. Not quite -- you can get to it if you're willing to do

Re: Graph library for Python (was: Re: python bijection)

2009-12-07 Thread geremy condra
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 graphine? I haven't had any specific requests for it, but if its something you need I can shuffle it towards the top of the to do pile. There are two main reasons

Re: question about imports in a class

2009-12-07 Thread Rhodri James
On Mon, 07 Dec 2009 22:18:49 -, J dreadpiratej...@gmail.com wrote: On Mon, Dec 7, 2009 at 16:57, Diez B. Roggisch de...@nospam.web.de wrote: if I put the import at the beginning of the class, it just dawned on me that perhaps I still have to explicitly call the function by class:

Re: question about imports in a class

2009-12-07 Thread Steven D'Aprano
On Mon, 07 Dec 2009 16:53:46 -0500, J wrote: A little more education and playing around and I'm still not quite sure how to do this... for the class i'm writing, I want to import os, sys and wmi globally for the class... The best advice is Do Not Do It That Way. Just do your imports at the

How decoupled are the Python frameworks?

2009-12-07 Thread shocks
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 modified implementation of

Re: Float precision and float equality

2009-12-07 Thread Carl Banks
On Dec 7, 10:53 am, dbd d...@ieee.org wrote: On Dec 7, 4:28 am, sturlamolden sturlamol...@yahoo.no wrote: ... You don't understand this at all do you? If you have a sine wave with an amplitude less than the truncation error, it will always be approximately equal to zero. Numerical

Re: Float precision and float equality

2009-12-07 Thread sturlamolden
On 7 Des, 06:43, dbd d...@ieee.org wrote: If you have samples of a sine wave with peak amplitude of one half eps, the abs(x- y) eps test would report all values on the sine wave as equal to zero. This would not be correct. You don't understand this at all do you? If you have a sine wave

Re: Float precision and float equality

2009-12-07 Thread dbd
On Dec 7, 4:28 am, sturlamolden sturlamol...@yahoo.no wrote: ... You don't understand this at all do you? If you have a sine wave with an amplitude less than the truncation error, it will always be approximately equal to zero. Numerical maths is about approximations, not symbolic

Re: question about imports in a class

2009-12-07 Thread Diez B. Roggisch
J schrieb: On Mon, Dec 7, 2009 at 16:57, Diez B. Roggisch de...@nospam.web.de wrote: if I put the import at the beginning of the class, it just dawned on me that perhaps I still have to explicitly call the function by class: sysinfo.py class myclass(): import os def

Re: Where is my namespace?

2009-12-07 Thread Simon Brunning
2009/12/7 Steven D'Aprano st...@remove-this-cybersource.com.au: On Mon, 07 Dec 2009 16:25:39 +, Simon Brunning wrote: If you do from blah import the imported module itself isn't bound to any name in the importing module - you can't get at it at all. Not quite -- you can get to it if

Re: Graph library for Python (was: Re: python bijection)

2009-12-07 Thread Steven D'Aprano
On Mon, 07 Dec 2009 17:23:24 -0500, geremy condra wrote:  * Graph.__iter__ could be mapped to an iterator using   the fastest traversal method for the graph nodes (ie. order does not   matter, it's only important that all nodes are found as fast as   possible) Again, it seems ambiguous as

Re: Graph library for Python (was: Re: python bijection)

2009-12-07 Thread geremy condra
On Mon, Dec 7, 2009 at 5:48 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Mon, 07 Dec 2009 17:23:24 -0500, geremy condra wrote:  * Graph.__iter__ could be mapped to an iterator using   the fastest traversal method for the graph nodes (ie. order does not   matter, it's

Duplicates of third-party libraries (was: When will Python 3 be fully deployed)

2009-12-07 Thread Ben Finney
Martin P. Hellwig martin.hell...@dcuktec.org writes: If the fear of customers disatification prevents you from using a certain version of X, you should consider a deployment strategy that cuts out dependencies as much as possible. Although this will result in a larger end package and possible

Re: Graph library for Python

2009-12-07 Thread M.-A. Lemburg
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 graphine? I haven't had any specific requests for it, but if its something you need I can shuffle it towards the top of the to do pile. There

Re: python proxy checker ,change to threaded version

2009-12-07 Thread r0g
Terry Reedy wrote: r0g wrote: The trick to threads is to create a subclass of threading.Thread, define the 'run' function and call the 'start()' method. I find threading quite generally useful so I created this simple generic function for running things in threads... Great idea. Thanks

test if an input string starts with a python expression

2009-12-07 Thread Torsten Mohr
Hi, i'd like to test if an input string starts with a python expression and also where that expression ends. An example: a_func(3*7, '''abc''') +5 pls some more The first part until (inclusive) the 5 should be found as an expression and the length of that string should also be detected.

Re: python proxy checker ,change to threaded version

2009-12-07 Thread r0g
Terry Reedy wrote: r0g wrote: The trick to threads is to create a subclass of threading.Thread, define the 'run' function and call the 'start()' method. I find threading quite generally useful so I created this simple generic function for running things in threads... Great idea. Thanks

Re: python proxy checker ,change to threaded version

2009-12-07 Thread r0g
Rhodri James wrote: On Mon, 07 Dec 2009 18:21:23 -, Terry Reedy tjre...@udel.edu wrote: r0g wrote: The trick to threads is to create a subclass of threading.Thread, define the 'run' function and call the 'start()' method. I find threading quite generally useful so I created this simple

Re: test if an input string starts with a python expression

2009-12-07 Thread zeph
It sort of sounds like you want a templating system: http://wiki.python.org/moin/Templating -- http://mail.python.org/mailman/listinfo/python-list

Re: question about imports in a class

2009-12-07 Thread r0g
Diez B. Roggisch wrote: J schrieb: On Mon, Dec 7, 2009 at 16:57, Diez B. Roggisch de...@nospam.web.de wrote: if I put the import at the beginning of the class, it just dawned on me that perhaps I still have to explicitly call the function by class: snip I'm not annoyed. I just wonder from

  1   2   3   >