Re: Python class gotcha with scope?

2009-06-20 Thread billy
great, thanks for the quick responses :) On Jun 21, 2:41 am, Carl Banks wrote: > On Jun 20, 11:32 pm, billy wrote: > > > I don't quite understand why this happens. Why doesn't b have its own > > version of r? If r was just an int instead of a dict, then it would. > > > >>> class foo: > > > ...

Re: Python class gotcha with scope?

2009-06-20 Thread Carl Banks
On Jun 20, 11:32 pm, billy wrote: > I don't quite understand why this happens. Why doesn't b have its own > version of r? If r was just an int instead of a dict, then it would. > > >>> class foo: > > ...     r = {} > ...     def setn(self, n): > ...             self.r["f"] = n > ...>>> a = foo() >

Re: Python class gotcha with scope?

2009-06-20 Thread Vincent
On Jun 21, 2:38 pm, Vincent wrote: > On Jun 21, 2:32 pm, billy wrote: > > > > > I don't quite understand why this happens. Why doesn't b have its own > > version of r? If r was just an int instead of a dict, then it would. > > > >>> class foo: > > > ...     r = {} > > ...     def setn(self, n): >

Re: Python class gotcha with scope?

2009-06-20 Thread Vincent
On Jun 21, 2:32 pm, billy wrote: > I don't quite understand why this happens. Why doesn't b have its own > version of r? If r was just an int instead of a dict, then it would. > > >>> class foo: > > ...     r = {} > ...     def setn(self, n): > ...             self.r["f"] = n > ...>>> a = foo() >

Python class gotcha with scope?

2009-06-20 Thread billy
I don't quite understand why this happens. Why doesn't b have its own version of r? If r was just an int instead of a dict, then it would. >>> class foo: ... r = {} ... def setn(self, n): ... self.r["f"] = n ... >>> a = foo() >>> a.setn(4) >>> >>> b = foo() >>> b.r {'f': 4} th

Rosetta Code: request for help

2009-06-20 Thread Paddy
Hi, If you like programming problems and reading about/creating solutions to tasks in many languages not just Python, then take a look at Rosetta Code: http://www.rosettacode.org . If you 'lurk' for a while and read the submissions of others to get a feal for the site, then their is a list of tasks

Re: Developing GUI applications

2009-06-20 Thread Juan Pablo Romero Méndez
PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/intro All the benefits of Qt: multiplataform, excellent documentation, great API, visual widget designer, etc, etc. For the coding itself, I use netbeans + python plugin. Regards, Juan Pablo 2009/6/21 Chris Rebert : > On Sat, Jun 20, 20

Re: Developing GUI applications

2009-06-20 Thread Chris Rebert
On Sat, Jun 20, 2009 at 6:37 PM, Grant Ito wrote: > Hi everyone. > > I'm looking to find out what people are using for an open source wysiwyg GUI > developer. I'm running both Linux and Windows but prefer to do my > development in Linux. I've got the most experience with Tkinter but am > willing to

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Carl Banks
On Jun 20, 8:18 pm, s...@pobox.com wrote: >     Carl> Maybe you don't intend to sound like you're saying "shut up and >     Carl> use C", but to me, that's how you come off.  If you're going to >     Carl> advise someone to use C, at least try to show some understanding >     Carl> for their concer

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Kay Schluehr
On 20 Jun., 17:28, Stefan Behnel wrote: > Kay Schluehr wrote: > >> You might want to read about "The Problem with Threads": > > >>http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf > > >> and then decide to switch to an appropriate concurrency model for your use > >> case. > > > and t

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread skip
Carl> I'm sure you think you're trying to be helpful, but you're coming Carl> off as really presumptuous with this casual dismissal of their Carl> concerns. My apologies, but in most cases there is more than one way to skin a cat. Trust me, if removing the global interpreter lock was

Re: calculating a self.value, self.randomnum = normalvariate(x, y)

2009-06-20 Thread Vincent Davis
Quoting Dennis Lee Bieber limitedNormal ( 75, 20 ) computed statistics: mu = 75.5121294828 sigma = 8.16374859991 Note how computing the input sigma such that 3*sigma does not exceed boundaries results in a narrow bell curve (hmm, and for this set, no one scored 95-100) retryNo

Re: KeyboardInterrupt eats my error and then won't be caught

2009-06-20 Thread greg
Philip Semanchuk wrote: Best of all, PyErr_CheckSignals() doesn't interfere with a Python- level signal handler if one is set. Ah, I hadn't realised that you were doing this in C code, and I was trying to think of a Python-level solution. For C code, the solution you give sounds like a good o

Developing GUI applications

2009-06-20 Thread Grant Ito
Hi everyone. I'm looking to find out what people are using for an open source wysiwyg GUI developer. I'm running both Linux and Windows but prefer to do my development in Linux. I've got the most experience with Tkinter but am willing to look at wxPython and Tix as well. Thus far I've looked i

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Jure Erznožnik
Add: Carl, Olivier & co. - You guys know exactly what I wanted. Others: Going back to C++ isn't what I had in mind when I started initial testing for my project. -- http://mail.python.org/mailman/listinfo/python-list

Re: reply to OT diversion (was: What is the best method to match a pattern in set of lines

2009-06-20 Thread Steven D'Aprano
Dennis Lee Bieber wrote: > On Sat, 20 Jun 2009 13:47:24 -0700 (PDT), Bearophile > declaimed the following in > gmane.comp.python.general: > >> This is a small OT post, sorry. >> >> Dennis Lee Bieber, may I ask why most or all your posts are set to "No- >> Archive"? >> > Taking into account som

Re: Decorator question (how to test if decorated function is in a class)

2009-06-20 Thread Martin P. Hellwig
Bruno Desthuilliers wrote: Short answer: this makes no sense. Absolutely right, took me a while to figure that out though :-) Lesson learned (again): If it really seems impossible to do something in Python, it is likely the proposed solution is flawed. -- MPH http://blog.dcuktec.com 'If con

Re: Inheritance and forward references (prototypes)

2009-06-20 Thread Dave Angel
Lorenzo Di Gregorio wrote: On Jun 20, 8:43 pm, Dave Angel wrote: Lorenzo Di Gregorio wrote: Hi, I'm wondering what would be the preferred way to solve the following forward reference problem: --- class BaseA(object): def __init__(

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Carl Banks
On Jun 20, 6:36 am, s...@pobox.com wrote: >     Carl> Here's the thing: not everyone complaining about the GIL is trying >     Carl> to get the "raw power of their machines."  They just want to take >     Carl> advantage of multiple cores so that their Python program runs >     Carl> faster. > > If

Re: persistent composites

2009-06-20 Thread Rhodri James
On Fri, 19 Jun 2009 15:56:04 +0100, Aaron Brady wrote: This is a welcome digression for me. I wasn't sure that my idea was being taken seriously. On a temperature scale from freezing to boiling, I took Rhodri's message to be somewhere in the single digits-- quite chilly. Correctly, though

Re: Measuring Fractal Dimension ?

2009-06-20 Thread Charles Yeomans
On Jun 18, 2009, at 2:21 PM, David C. Ullrich wrote: On Wed, 17 Jun 2009 05:46:22 -0700 (PDT), Mark Dickinson wrote: On Jun 17, 1:26 pm, Jaime Fernandez del Rio wrote: On Wed, Jun 17, 2009 at 1:52 PM, Mark Dickinson wrote: Maybe James is thinking of the standard theorem that says that if

Re: Rich comparison methods don't work in sets?

2009-06-20 Thread Robert Kern
On 2009-06-20 18:22, Terry Reedy wrote: Gustavo Narea wrote: Hello again, everybody. Thank you very much for your responses. You guessed right, I didn't use the __hash__ method (and I forgot to mention that, sorry). And unfortunately, I think I can't make them hashable, because the objects are

Re: Rich comparison methods don't work in sets?

2009-06-20 Thread Terry Reedy
Gustavo Narea wrote: Hello again, everybody. Thank you very much for your responses. You guessed right, I didn't use the __hash__ method (and I forgot to mention that, sorry). And unfortunately, I think I can't make them hashable, because the objects are compared based on their attributes, whic

Re: Inheritance and forward references (prototypes)

2009-06-20 Thread Rhodri James
On Sat, 20 Jun 2009 21:26:56 +0100, Lorenzo Di Gregorio wrote: Thank you for your help: I'm working on a rather large source, but I think I have isolated the problem now. This listing generates an error: --- class BaseA(object): def __init__(se

Inheritance and forward references (prototypes)

2009-06-20 Thread Xavier Ho
Arg, forgot to post to the mailing list again. -_- On a smaller issue, don't you need to do: class DebugA(BaseA): def __init__(self): BaseA.__init__(self) return As in, explicitly call the __init__ function when you initalise DebugA, since DebugA extends BaseA? I'm just gett

Re: Rich comparison methods don't work in sets?

2009-06-20 Thread Aaron Brady
On Jun 20, 9:27 am, MRAB wrote: > Gustavo Narea wrote: > > Hello again, everybody. > > > Thank you very much for your responses. You guessed right, I didn't > > use the __hash__ method (and I forgot to mention that, sorry). > > > And unfortunately, I think I can't make them hashable, because the >

Python-URL! - weekly Python news and links (Jun 20)

2009-06-20 Thread Gabriel Genellina
QOTW: "... open recursion with abstraction is supported in OOP but it requires elaborate and rather tedious boilerplate in FP ..." - Martin Odersky http://www.nabble.com/Re%3A--scala--usefulness-of-OOP-p23273389.html How to write a method that may act both as an instance method a

Re: Rich comparison methods don't work in sets?

2009-06-20 Thread Robert Kern
On 2009-06-20 11:27, MRAB wrote: Gustavo Narea wrote: Hello again, everybody. Thank you very much for your responses. You guessed right, I didn't use the __hash__ method (and I forgot to mention that, sorry). And unfortunately, I think I can't make them hashable, because the objects are compar

Re: What is the best method to match a pattern in set of lines

2009-06-20 Thread Bearophile
This is a small OT post, sorry. Dennis Lee Bieber, may I ask why most or all your posts are set to "No- Archive"? > HTTP://www.bestiaria.com/ I think there are other furries beside you around here. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: KeyboardInterrupt eats my error and then won't be caught

2009-06-20 Thread Philip Semanchuk
On Jun 20, 2009, at 7:41 AM, Piet van Oostrum wrote: After my previous experiment I was curious how this works with input(). I replaced the sem.acquire() with raw_input() and ran the same tests. Now the inner exception is really taken so it works like the OP expected. The exception, however

Re: Inheritance and forward references (prototypes)

2009-06-20 Thread Lorenzo Di Gregorio
On Jun 20, 8:43 pm, Dave Angel wrote: > Lorenzo Di Gregorio wrote: > > Hi, > > > I'm wondering what would be the preferred way to solve the following > > forward reference problem: > > > --- > > class BaseA(object): > >     def __init__(self): > >         return

Re: Inheritance and forward references (prototypes)

2009-06-20 Thread Piet van Oostrum
> Steven D'Aprano (SD) wrote: >SD> Lorenzo Di Gregorio wrote: >>> Hi, >>> >>> I'm wondering what would be the preferred way to solve the following >>> forward reference problem: >SD> You don't actually explain what is the problem. Fortunately, I'm good at >SD> guessing, and I think I can gu

Re: What is the best method to match a pattern in set of lines

2009-06-20 Thread Lie Ryan
Dennis Lee Bieber wrote: > On Fri, 19 Jun 2009 17:52:05 -0700 (PDT), Terminator > declaimed the following in > gmane.comp.python.general: > >> Hello, >> My requierment is to get the "Stick Tag" value from the below o/p and >> based on tag take different actions. What is the best way to implement

Re: raw_input with a pre-compiled data

2009-06-20 Thread Dave Angel
patx wrote: Could you use if elif statements? Don't understand what you mean really? On Sat, Jun 20, 2009 at 3:01 PM, Dave Angel wrote: Luca wrote: Hi all. I need to use a function like the raw_input to read data from user command line, but I really like to pre-compile the choice a

Re: raw_input with a pre-compiled data

2009-06-20 Thread Dave Angel
Luca wrote: Hi all. I need to use a function like the raw_input to read data from user command line, but I really like to pre-compile the choice and I'm not able to do this. There is some other function/module I can use? I wanna to pre-compile the raw_input input line with the current working pa

Re: Inheritance and forward references (prototypes)

2009-06-20 Thread Dave Angel
Lorenzo Di Gregorio wrote: Hi, I'm wondering what would be the preferred way to solve the following forward reference problem: --- class BaseA(object): def __init__(self): return class DebugA(BaseA): def __init__(self): return # here

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Lie Ryan
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jean-Paul Calderone wrote: > On Sat, 20 Jun 2009 00:07:27 GMT, Lie Ryan wrote: >> [snip] >> >> Perhaps we should have more built-in/stdlib operations that can release >> GIL safely to release GIL by default? And perhaps some builtin/stdlib >> should r

Re: calculating a self.value, self.randomnum = normalvariate(x, y)

2009-06-20 Thread Vincent Davis
Quoting Steven, >Truncating with a while loop will result in something closer to this: > 000: * > 010: * > 020: ** > 030: > 040: *** > 050: * > 060: ** > 070: > 080: * > 090: ** > 100: * > > which is far less distorted." That is why I was thinking of a while l

Re: raw_input with a pre-compiled data

2009-06-20 Thread Gabriel Genellina
En Sat, 20 Jun 2009 11:17:01 -0300, Luca escribió: I need to use a function like the raw_input to read data from user command line, but I really like to pre-compile the choice and I'm not able to do this. There is some other function/module I can use? I wanna to pre-compile the raw_input input

Re: raw_input with a pre-compiled data

2009-06-20 Thread Chris Rebert
On Sat, Jun 20, 2009 at 7:17 AM, Luca wrote: > Hi all. > > I need to use a function like the raw_input to read data from user > command line, but I really like to pre-compile the choice and I'm not > able to do this. There is some other function/module I can use? > I wanna to pre-compile the raw_in

Re: Rich comparison methods don't work in sets?

2009-06-20 Thread Gabriel Genellina
En Sat, 20 Jun 2009 12:50:41 -0300, Gustavo Narea escribió: Thank you very much for your responses. You guessed right, I didn't use the __hash__ method (and I forgot to mention that, sorry). And unfortunately, I think I can't make them hashable, because the objects are compared based on thei

Re: Rich comparison methods don't work in sets?

2009-06-20 Thread MRAB
Gustavo Narea wrote: Hello again, everybody. Thank you very much for your responses. You guessed right, I didn't use the __hash__ method (and I forgot to mention that, sorry). And unfortunately, I think I can't make them hashable, because the objects are compared based on their attributes, whic

Re: Inheritance and forward references (prototypes)

2009-06-20 Thread Steven D'Aprano
Lorenzo Di Gregorio wrote: > Hi, > > I'm wondering what would be the preferred way to solve the following > forward reference problem: You don't actually explain what is the problem. Fortunately, I'm good at guessing, and I think I can guess what your problem is (see below): >

Re: Rich comparison methods don't work in sets?

2009-06-20 Thread Steven D'Aprano
Gustavo Narea wrote: > Hello again, everybody. > > Thank you very much for your responses. You guessed right, I didn't > use the __hash__ method (and I forgot to mention that, sorry). > > And unfortunately, I think I can't make them hashable, because the > objects are compared based on their att

Re: Rich comparison methods don't work in sets?

2009-06-20 Thread Gustavo Narea
Hello again, everybody. Thank you very much for your responses. You guessed right, I didn't use the __hash__ method (and I forgot to mention that, sorry). And unfortunately, I think I can't make them hashable, because the objects are compared based on their attributes, which are in turn other kin

Inheritance and forward references (prototypes)

2009-06-20 Thread Lorenzo Di Gregorio
Hi, I'm wondering what would be the preferred way to solve the following forward reference problem: --- class BaseA(object): def __init__(self): return class DebugA(BaseA): def __init__(self): return # here I would have a prototype of

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Stefan Behnel
Kay Schluehr wrote: >> You might want to read about "The Problem with Threads": >> >> http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf >> >> and then decide to switch to an appropriate concurrency model for your use >> case. > > and to a programming language that supports it. Maybe

Re: calculating a self.value, self.randomnum = normalvariate(x, y)

2009-06-20 Thread Steven D'Aprano
Vincent Davis wrote: >> # Clamp a normal distribution outcome I don't know who you are quoting -- you should give attribution to them. >> def clamp(input, min=0, max=100): ... >> if input < min: >> return min >> elif input > max: >> return max >> else: >> return input An easier way to do this:

Re: calculating a self.value, self.randomnum = normalvariate(x, y)

2009-06-20 Thread Xavier Ho
> > def __int__(self, x, y): > x = -1 >while not 0 <= x <= 100: >x = normalvariate(x, y) ># do other stuff > > That is the correct way to truncate a normal distribution. > > Thanks for the response. But why would you set the mean to -1 to begin? > > x = max(0, min(100, normal

Re: Checking for binary data in a string

2009-06-20 Thread Grant Edwards
On 2009-06-19, Lie Ryan wrote: > Grant Edwards wrote: >> On 2009-06-19, Mitko Haralanov wrote: >> >>> I have a question about finding out whether a string contains >>> binary data? >> >> All strings contain binary data. > > Not quite, (python 2.x's) strings are binary data. > > It just happen

Re: calculating a self.value, self.randomnum = normalvariate(x, y)

2009-06-20 Thread Steven D'Aprano
Vincent Davis wrote: > I currently have something like this. > > class applicant(): > def __int__(self, x, y): > self.randomnum = normalvariate(x, y) > then other stuff > > x, y are only used to calculate self.randomnum and this seems to > work. But I want self.randomnum to be 0 <=

Re: Convert hash to struct

2009-06-20 Thread Steven D'Aprano
Jason wrote: > Here's my general-purpose solution for doing this: > > class Dict2Class(object): > """ > Update like a dictionary, but expose the keys as class properties. I'm afraid that's wrong. It's wrong twice: * Properties are computed attributes. These are not, they are regular att

raw_input with a pre-compiled data

2009-06-20 Thread Luca
Hi all. I need to use a function like the raw_input to read data from user command line, but I really like to pre-compile the choice and I'm not able to do this. There is some other function/module I can use? I wanna to pre-compile the raw_input input line with the current working path. -- -- lu

Re: calculating a self.value, self.randomnum = normalvariate(x, y)

2009-06-20 Thread Dave Angel
Vincent Davis wrote: I currently have something like this. class applicant(): def __int__(self, x, y): self.randomnum = normalvariate(x, y) then other stuff x, y are only used to calculate self.randomnum and this seems to work. But I want self.randomnum to be 0 <= randomnum <= 100

Re: timeit and __future__

2009-06-20 Thread Steven D'Aprano
Karl Chen wrote: > > I wanted to time something that uses with_statement, in python2.5. > Importing __future__ in the statement or the setup doesn't work > since it's not the beginning of the code being compiled. Other > than using a separate module, I could only come up with this: > > time

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread skip
Carl> Here's the thing: not everyone complaining about the GIL is trying Carl> to get the "raw power of their machines." They just want to take Carl> advantage of multiple cores so that their Python program runs Carl> faster. If their code is CPU-bound it's likely that rewriting

Re: Python in Nashville

2009-06-20 Thread MRAB
yell...@aol.com wrote: I maintain a math hobby - magic square web page http://www.knechtmagicsquare.paulscomputing.com/ A very bright fellow in England sent me a algorithm written in python to solve a problem I was working on. I can't seem to get it to work ... syntax problems

calculating a self.value, self.randomnum = normalvariate(x, y)

2009-06-20 Thread Xavier Ho
(sorry Vincent, I sent it to you but not the mailing list.) Good luck, here are my answers: Why not have clamp in the class? Because Clamp itself is a reusable function. I was rather surprised it's not in the standard math module. if __name__ == "__main__" is only meaningful when the .py file it

Re: calculating a self.value, self.randomnum = normalvariate(x, y)

2009-06-20 Thread Vincent Davis
> # Clamp a normal distribution outcome > > import random > > class applicant(): >     def __init__(self, x, y): >     self.randomnum = clamp(random.normalvariate(x, y), 0, 100) > > def clamp(input, min=0, max=100): >     """Clamps the input between min and max. > >     if  input < min, returns

Re: IDLE comments

2009-06-20 Thread MRAB
Chris Rebert wrote: On Wed, Jun 17, 2009 at 11:23 PM, Jason Gervich wrote: Why does IDLE use two hash marks for comments (##)? Most other editors (Geany, SPE) use a single hash mark (#) to designate comments. I would guess to distinguish its (usually block) comments from manually-added (usuall

Re: KeyboardInterrupt eats my error and then won't be caught

2009-06-20 Thread Piet van Oostrum
After my previous experiment I was curious how this works with input(). I replaced the sem.acquire() with raw_input() and ran the same tests. Now the inner exception is really taken so it works like the OP expected. The exception, however is KeyboardInterrupt, not the special exception from the IPC

Re: persistent composites

2009-06-20 Thread Aaron Brady
On Jun 19, 7:00 am, "Rhodri James" wrote: > On Fri, 19 Jun 2009 14:24:34 +0100, Aaron Brady   > wrote: > > > You are not being any help, Rhodri, in your question. > > To you, perhaps not.  To me, it has at least had the effect of making > what you're trying to do (write a pythonic object database

Re: Python in Nashville

2009-06-20 Thread Yell123
I maintain a math hobby - magic square web page _http://www.knechtmagicsquare.paulscomputing.com/_ (http://www.knechtmagicsquare.paulscomputing.com/) A very bright fellow in England sent me a algorithm written in python to solve a problem I was working on. I can't seem to get it to w

YASS (Yet Another Success Story)

2009-06-20 Thread k3xji
Hi all, Started a project year ago with hard goals in mind : Developing a game server which can handle thousands of clients simultaneously.System must be stable, scalable, efficient, and if the client need to migrate the server to another OS, this will be a matter of time, if possible without chan

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread OdarR
On 20 juin, 11:02, Carl Banks wrote: > Here's the thing: not everyone complaining about the GIL is trying to > get the "raw power of their machines."  They just want to take > advantage of multiple cores so that their Python program runs > faster. > > It would be rude and presumptuous to tell such

Re: Question about None

2009-06-20 Thread Paul Rubin
Paul LaFollette writes: > So, what I would like is some sort of object that is a "kind of" > everything but contains nothing, a unique minimal element of the > partial ordering imposed on the set of classes by the inheritance > heierarchy. Whilst I am not naive mathematically, I am relatively > n

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Kay Schluehr
> You might want to read about "The Problem with Threads": > > http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf > > and then decide to switch to an appropriate concurrency model for your use > case. and to a programming language that supports it. -- http://mail.python.org/mailman/

Re: calculating a self.value, self.randomnum = normalvariate(x, y)

2009-06-20 Thread Xavier Ho
While there are a lot of valid ways to do it, anything you do will change the outcome of the probability anyway. I'm assuming you are just looking to clamp the values. Try this: http://codepad.org/NzlmSMN9 (it runs the code, too) == # Clamp a normal distri

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Carl Banks
On Jun 19, 4:35 pm, a...@pythoncraft.com (Aahz) wrote: > In article <157e0345-74e0-4144-a2e6-2b4cc854c...@z7g2000vbh.googlegroups.com>, > Carl Banks   wrote: > >I wish Pythonistas would be more willing to acknowledge the (few) > >drawbacks of the language (or implementation, in this case) instead o

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Carl Banks
On Jun 19, 4:42 pm, Christian Heimes wrote: > OdarR schrieb: > > > On 19 juin, 21:41, Carl Banks wrote: > >> He's saying that if your code involves extensions written in C that > >> release the GIL, the C thread can run on a different core than the > >> Python-thread at the same time.  The GIL is

Re: walking a directory with very many files

2009-06-20 Thread Lawrence D'Oliveiro
In message , Lie Ryan wrote: > Lawrence D'Oliveiro wrote: > >> In message <%zv_l.19493$y61.5...@news-server.bigpond.net.au>, Lie Ryan >> wrote: >> >>> Yeah, it might be possible to just mv the file from outside, but not >>> being able to enter a directory just because you've got too many files >

Re: walking a directory with very many files

2009-06-20 Thread Lawrence D'Oliveiro
In message <20090619134015.349ba...@malediction>, Mike Kazantsev wrote: > On Fri, 19 Jun 2009 17:53:40 +1200 > Lawrence D'Oliveiro wrote: > >> In message <20090618081423.2e035...@coercion>, Mike Kazantsev wrote: >> >> > On Thu, 18 Jun 2009 10:33:49 +1200 >> > Lawrence D'Oliveiro wrote: >> > >

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Piet van Oostrum
> Ross Ridge (RR) wrote: >RR> By definition an I/O bound thread isn't CPU bound so won't benefit from >RR> improved CPU resources. But doing I/O is not the same as being I/O bound. And Python allows multithreading when a thread does I/O even if that thread is not I/O bound but CPU bound. See

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Piet van Oostrum
> Jure Erznožnik (JE) wrote: >JE> I have shown my benchmarks. See first post and click on the link. >JE> That's the reason I started this discussion. >JE> All I'm saying is that you can get threading benefit, but only if the >JE> threading in question is implemented in C plugin. >JE> I have

Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread Piet van Oostrum
> Jure Erznožnik (JE) wrote: >JE> Sorry, just a few more thoughts: >JE> Does anybody know why GIL can't be made more atomic? I mean, use >JE> different locks for different parts of code? >JE> This way there would be way less blocking and the plugin interface >JE> could remain the same (the in

Re: How to check if file is open on Windows XP?

2009-06-20 Thread Tim Golden
Dudeja, Rajat wrote: Hi, I'm looking for a fascility that can check if the file is open on Windows XP and if the file is open (say a notepad file is open), I want to close that file (i.e the notepad application) In short, this is far trickier than you might imagine. It's come up a number of

Re: KeyboardInterrupt eats my error and then won't be caught

2009-06-20 Thread Piet van Oostrum
> greg (g) wrote: >g> Philip Semanchuk wrote: >>> try: >>> sem.acquire() # User hits Ctrl + C while this is waiting >>> except: >>> print "* I caught it!" >>> Instead a KeyboardInterrupt error is propagated up to the interpreter >>> and the process is killed as if the try/except wa

Join Python Global Meeting Sunday June 21 using VOIP - BerkeleyTIP

2009-06-20 Thread john_re
Join the friendly Python Global [& ALL FREE SW HW & CULTURE] community Meeting: this Sunday, June 21, using VOIP, 10A - 6P Pacific USA time [GMT - 8? 7? hours] = 1P - 9P Eastern USA = 6P - 2A??? GMT - Daylight savings correction? +7 hours? at the BerkeleyTIP Global Free SW HW & Culture meeting