Re: Modifying Class Object

2010-02-13 Thread Steve Howell
On Feb 13, 11:21 pm, Steven D'Aprano wrote: > On Sat, 13 Feb 2010 21:33:50 -0800, Steve Howell wrote: > > You seem to be missing the point that "curly braces" is a concrete > > term that very specifically applies to spelling. > > And you seem to be missing the point that "pointer" is also a concre

Re: Modifying Class Object

2010-02-13 Thread Alf P. Steinbach
* Steven D'Aprano: On Sat, 13 Feb 2010 21:33:50 -0800, Steve Howell wrote: You seem to be missing the point that "curly braces" is a concrete term that very specifically applies to spelling. And you seem to be missing the point that "pointer" is also a concrete term that very specifically ap

Re: Modifying Class Object

2010-02-13 Thread Steven D'Aprano
On Sat, 13 Feb 2010 21:33:50 -0800, Steve Howell wrote: > You seem to be missing the point that "curly braces" is a concrete > term that very specifically applies to spelling. And you seem to be missing the point that "pointer" is also a concrete term that very specifically applies to, well, poi

Re: iglob performance no better than glob

2010-02-13 Thread Cameron Simpson
On 31Jan2010 16:23, Kyp wrote: | On Jan 31, 2:44 pm, Peter Otten <__pete...@web.de> wrote: | > Kyp wrote: | > > I have a dir with a large # of files that I need to perform operations | > > on, but only needing to access a subset of the files, i.e. the first | > > 100 files. | > > Using glob is ver

Re: Modifying Class Object

2010-02-13 Thread Steve Howell
On Feb 13, 9:13 pm, Steven D'Aprano wrote: > On Sat, 13 Feb 2010 20:11:06 -0800, Steve Howell wrote: > > For a suitably wide definition of pointers CPython does indeed have > > pointers, and your example is only a weaker case of that truth.  There > > is no reductio adsurbum.  If I argued that CPy

Re: Modifying Class Object

2010-02-13 Thread Steven D'Aprano
On Sat, 13 Feb 2010 20:11:06 -0800, Steve Howell wrote: > For a suitably wide definition of pointers CPython does indeed have > pointers, and your example is only a weaker case of that truth. There > is no reductio adsurbum. If I argued that CPython had curly braced > syntax that would be absurd

Re: ANN: ActivePython 2.5.5.7 is now available

2010-02-13 Thread Sridhar Ratnakumar
On 2010-02-13, at 1:25 AM, Dennis Lee Bieber wrote: > On Thu, 11 Feb 2010 16:22:49 -0800, Sridhar Ratnakumar > declaimed the following in > gmane.comp.python.general: > >> I'm happy to announce that ActivePython 2.5.5.7 is now available for >> download from: >> >>http://www.activestate.com

Re: Modifying Class Object

2010-02-13 Thread Steve Howell
On Feb 13, 7:53 pm, Steven D'Aprano wrote: > On Sat, 13 Feb 2010 18:54:34 -0800, Steve Howell wrote: > > On Feb 13, 6:41 pm, a...@pythoncraft.com (Aahz) wrote: > > > Regardless of how CPython manages its state internally, Python as a > > > programming language does not have pointers.   > > > I agr

Re: Hashing in python

2010-02-13 Thread Paul Rubin
Vish writes: > I need to hash 3d coordinates to a grid which has been divided into > 4*4*4 squares. Using python, I thought of a simple way as follows: Use the built-in hash function: >>> p = (1, 2, 3) >>> print hash(p) 2528502973977326415 You can of course mod that by the table siz

Re: Modifying Class Object

2010-02-13 Thread Steven D'Aprano
On Sat, 13 Feb 2010 18:54:34 -0800, Steve Howell wrote: > On Feb 13, 6:41 pm, a...@pythoncraft.com (Aahz) wrote: > > Regardless of how CPython manages its state internally, Python as a > > programming language does not have pointers.   > > I agree with your statement for a suitably narrow definit

Re: Modifying Class Object

2010-02-13 Thread Alf P. Steinbach
* Aahz: In article , Alf P. Steinbach wrote: My original statement, with reference to the Java language spec, didn't say much more about the language than that it has assignable references. Assuming this is what you're referring to: Python passes pointers by value, just as e.g. Java does

Replace various regex

2010-02-13 Thread Martin
Hi, I am trying to come up with a more generic scheme to match and replace a series of regex, which look something like this... 19.01,16.38,0.79,1.26,1.00 ! canht_ft(1:npft) 5.0, 4.0, 2.0, 4.0, 1.0 ! lai(1:npft) Ideally match the pattern to the right of the "!" sign (e.g. lai), I would

Re: Please help with MemoryError

2010-02-13 Thread rantingrick
On Feb 12, 4:10 pm, Steve Holden wrote: > Antoine Pitrou wrote: > > Le Fri, 12 Feb 2010 17:14:57 +, Steven D'Aprano a écrit : On Feb 12, 4:10 pm, Steve Holden wrote: > Antoine Pitrou wrote: > > Le Fri, 12 Feb 2010 17:14:57 +, Steven D'Aprano a écrit : Steve, Why do so many of your posts

Re: Modifying Class Object

2010-02-13 Thread Steve Howell
This thread is interesting on many levels. What is the core question that is being examined here? -- http://mail.python.org/mailman/listinfo/python-list

Re: Modifying Class Object

2010-02-13 Thread Steven D'Aprano
On Fri, 12 Feb 2010 21:26:24 +0100, Alf P. Steinbach wrote: > Yes, I do count this as a personal attack and flaming. > > The litmus test for that is that it says something very negative about > the person you're debating with. As negative as accusing somebody of intentionally lying? Or is it on

Re: Modifying Class Object

2010-02-13 Thread Alf P. Steinbach
* Bruno Desthuilliers: Alf P. Steinbach a écrit : (snip) This group has an extraordinary high level of flaming and personal attacks Oh my... (snip remaining non-sense) Mr Steinbach, I bet you'll count this as another "flaming" and "personal attack", but nonetheless : you might have happier

Re: Modifying Class Object

2010-02-13 Thread Bruno Desthuilliers
Alf P. Steinbach a écrit : (snip) This group has an extraordinary high level of flaming and personal attacks Oh my... (snip remaining non-sense) Mr Steinbach, I bet you'll count this as another "flaming" and "personal attack", but nonetheless : you might have happier time if you were able t

Re: MemoryError, can I use more?

2010-02-13 Thread Diez B. Roggisch
Am 13.02.10 17:18, schrieb Anssi Saari: Nobody writes: A single process can't use much more than 2GiB of RAM without a 64-bit CPU and OS. That's not really true. Even Windows XP has the /3GB boot option to allow 3 GiB per process. On PCs, free operating systems and server Windows can use PAE

Re: MemoryError, can I use more?

2010-02-13 Thread Anssi Saari
Nobody writes: > A single process can't use much more than 2GiB of RAM without a 64-bit CPU > and OS. That's not really true. Even Windows XP has the /3GB boot option to allow 3 GiB per process. On PCs, free operating systems and server Windows can use PAE to give access to full 4 GB per process

Re: How to measure elapsed time under Windows?

2010-02-13 Thread Tim Roberts
"Gabriel Genellina" wrote: > >The original problem was with the RDTSC instruction on multicore CPUs; >different cores may yield different results because they're not >synchronized at all times. Not true. The synchronization issue has two causes: initial synchronization at boot time, and pow

Re: search entire drive say c:

2010-02-13 Thread Tim Golden
On 12/02/2010 12:17, prakash jp wrote: Hi all, can any of u help to search a file say "abc.txt" in entire c drive (windows) and print the path/s stating such a files presence. This sounds rather like homework... Have a look at os.walk TJG -- http://mail.python.org/mailman/listinfo/python-lis

Re: Sorting a list of lists

2010-02-13 Thread R (Chandra) Chandrasekhar
MRAB wrote: You'd have to post an example of that, but you could try deleting some of the entries before sorting so see whether you can still reproduce the problem with a smaller list. John Posner wrote: Please cut-and-paste the exact error message (or other evidence of "failure") into a mess

Re: Modifying Class Object

2010-02-13 Thread Steve Howell
On Feb 13, 6:10 pm, MRAB wrote: > Alf P. Steinbach wrote: > > * Steve Howell: > >> This thread is interesting on many levels.  What is the core question > >> that is being examined here? > > > I think that regarding the technical it is whether a Python name refers > > to an object or not. I mainta

Re: Modifying Class Object

2010-02-13 Thread Steve Howell
On Feb 13, 6:41 pm, a...@pythoncraft.com (Aahz) wrote: > In article , > Alf P. Steinbach wrote: > > > > >My original statement, with reference to the Java language spec, > >didn't say much more about the language than that it has assignable > >references. > > Assuming this is what you're referring

Re: Selecting a file in a directory

2010-02-13 Thread rantingrick
On Feb 13, 8:00 pm, vsoler wrote: > On Feb 14, 2:45 am, rantingrick wrote: (..snip..) > Excellent!!! Just what I needed! For your case, since it seems you are writing a "console type" application you may want to subdue the root window and show the user a file dialog window *only*. You can do t

Re: Modifying Class Object

2010-02-13 Thread Aahz
In article , Alf P. Steinbach wrote: > >My original statement, with reference to the Java language spec, >didn't say much more about the language than that it has assignable >references. Assuming this is what you're referring to: Python passes pointers by value, just as e.g. Java does. Then

Re: To (monkey)patch or not to (monkey)patch, that is the question

2010-02-13 Thread Aahz
In article <1410d2e2-a6f2-4b6c-a745-6d3e34994...@q16g2000yqq.googlegroups.com>, > George Sakkis wrote: > >I was talking to a colleague about one rather unexpected/undesired >(though not buggy) behavior of some package we use. Although there is >an easy fix (or at least workaround) on our end with

Re: working with laptop battery

2010-02-13 Thread Tim Chase
Daniel Dalton wrote: On Sat, Feb 13, 2010 at 05:26:02PM -0800, Chris Rebert wrote: It's probably gonna depend on which OS you're running. Which would be...? Sorry, forgot to mention this. I'm running debian linux. You should be able to read/poll the various files in /proc/acpi/battery/BA

Re: working with laptop battery

2010-02-13 Thread Daniel Fetchinson
>> It's probably gonna depend on which OS you're running. Which would be...? > > Sorry, forgot to mention this. I'm running debian linux. I don't know about python modules but have a look at /proc/acpi/battery/BAT0/info /proc/acpi/battery/BAT0/state You can parse the numbers you want from there.

Re: working with laptop battery

2010-02-13 Thread Chris Colbert
You'll need acpi installed: In [6]: import subprocess In [7]: p = subprocess.Popen('acpi', stdout=subprocess.PIPE) In [8]: output, errors = p.communicate() In [9]: print output --> print(output) Battery 0: Full, 100%, rate information unavailable On Sat, Feb 13, 2010 at 8:43 PM, Daniel D

Re: Modifying Class Object

2010-02-13 Thread MRAB
Alf P. Steinbach wrote: * Steve Howell: This thread is interesting on many levels. What is the core question that is being examined here? I think that regarding the technical it is whether a Python name refers to an object or not. I maintain that it does, and that the reference can be copie

Re: Modifying Class Object

2010-02-13 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: Alf P. Steinbach wrote: * Michael Sparks: [Due to the appearance of reasoned discussion (it's not practical to read it all!) [...] Therefore to say "in reality the implementation will be passing a reference or pointer" is invalid. There

Re: Selecting a file in a directory

2010-02-13 Thread vsoler
On Feb 14, 2:45 am, rantingrick wrote: > On Feb 13, 7:28 pm, "Alf P. Steinbach" wrote: > > > > > * vsoler: > > > > Hi, > > > > My python script needs to work with a .txt file in a directory. I > > > would like to give the user the possibility to choose the file he > > > needs to work on in as muc

Re: multiprocessing and games

2010-02-13 Thread MRAB
Brian Blais wrote: On Feb 13, 2010, at 12:54 , MRAB wrote: Brian Blais wrote: I've been thinking about implementing some simple games Forget about global variables, they're not worth it! :-) Think in terms of messages, sent via pipes, sockets or multiprocessing queues. okay...let's make

Re: Selecting a file in a directory

2010-02-13 Thread rantingrick
On Feb 13, 7:28 pm, "Alf P. Steinbach" wrote: > * vsoler: > > > Hi, > > > My python script needs to work with a .txt file in a directory. I > > would like to give the user the possibility to choose the file he > > needs to work on in as much the same way as I open a .xls file in > > Excel, that is

Re: Selecting a file in a directory

2010-02-13 Thread Steven D'Aprano
On Sat, 13 Feb 2010 17:21:51 -0800, vsoler wrote: > Hi, > > My python script needs to work with a .txt file in a directory. I would > like to give the user the possibility to choose the file he needs to > work on in as much the same way as I open a .xls file in Excel, that is, > I want to make ap

Re: Modifying Class Object

2010-02-13 Thread Steve Holden
Alf P. Steinbach wrote: > * Steve Holden: >> Alf P. Steinbach wrote: >>> * Michael Sparks: >>> [Due to the appearance of reasoned discussion (it's not practical to >>> read it all!) >> [...] Therefore to say "in reality the implementation will be passing a reference or pointer" is invalid

Re: Modifying Class Object

2010-02-13 Thread Alf P. Steinbach
* Steve Howell: This thread is interesting on many levels. What is the core question that is being examined here? I think that regarding the technical it is whether a Python name refers to an object or not. I maintain that it does, and that the reference can be copied, and that the semantics

Re: working with laptop battery

2010-02-13 Thread Daniel Dalton
On Sat, Feb 13, 2010 at 05:26:02PM -0800, Chris Rebert wrote: > It's probably gonna depend on which OS you're running. Which would be...? Sorry, forgot to mention this. I'm running debian linux. Thanks, Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Selecting a file in a directory

2010-02-13 Thread vsoler
On Feb 14, 2:28 am, "Alf P. Steinbach" wrote: > * vsoler: > > > Hi, > > > My python script needs to work with a .txt file in a directory. I > > would like to give the user the possibility to choose the file he > > needs to work on in as much the same way as I open a .xls file in > > Excel, that is

Re: threading and signals - main thread solely responsible for signal handling?

2010-02-13 Thread Cameron Simpson
On 13Feb2010 17:22, exar...@twistedmatrix.com wrote: | On 04:43 pm, malig...@gmail.com wrote: | >The main part of my script is a function that does many long reads | >(urlopen, it's looped). Since I'm hell-bent on employing SIGINFO to | >display some stats, I needed to run foo() as a seperate thre

Re: Modifying Class Object

2010-02-13 Thread Alf P. Steinbach
* Benjamin Kaplan: On Sat, Feb 13, 2010 at 7:50 PM, Alf P. Steinbach wrote: At this point consider whether it's possible to implement Pascal in Haskell. If it is possible, then you have a problem wrt. drawing conclusions about pointers in Pascal, uh oh, they apparently can't exist. But if it

Re: working with laptop battery

2010-02-13 Thread Shashwat Anand
I too am interested as to which module should I use. My OS is OS X Snow Leopard. On Sun, Feb 14, 2010 at 6:56 AM, Chris Rebert wrote: > On Sat, Feb 13, 2010 at 4:48 PM, Daniel Dalton > wrote: > > Hi, > > > > I'm constantly working in the command line and need to write a program > > to give me a

Re: Selecting a file in a directory

2010-02-13 Thread Alf P. Steinbach
* vsoler: Hi, My python script needs to work with a .txt file in a directory. I would like to give the user the possibility to choose the file he needs to work on in as much the same way as I open a .xls file in Excel, that is, I want to make appear the "Windows'" window and let the user choose.

Re: working with laptop battery

2010-02-13 Thread Chris Rebert
On Sat, Feb 13, 2010 at 4:48 PM, Daniel Dalton wrote: > Hi, > > I'm constantly working in the command line and need to write a program > to give me alerts on my battery. Can someone please tell me what module > I should use to access battery information? Looking for something that > perhaps makes

Re: Modifying Class Object

2010-02-13 Thread Benjamin Kaplan
On Sat, Feb 13, 2010 at 7:50 PM, Alf P. Steinbach wrote: > > At this point consider whether it's possible to implement Pascal in Haskell. > > If it is possible, then you have a problem wrt. drawing conclusions about > pointers in Pascal, uh oh, they apparently can't exist. > > But if it is not pos

Re: Modifying Class Object

2010-02-13 Thread Mark Lawrence
Alf P. Steinbach wrote: * Steve Holden: Alf P. Steinbach wrote: * Michael Sparks: [Due to the appearance of reasoned discussion (it's not practical to read it all!) [...] Therefore to say "in reality the implementation will be passing a reference or pointer" is invalid. There is after all at

working with laptop battery

2010-02-13 Thread Daniel Dalton
Hi, I'm constantly working in the command line and need to write a program to give me alerts on my battery. Can someone please tell me what module I should use to access battery information? Looking for something that perhaps makes use of acpi so I can get estimated time left as well as a percenta

Re: Modifying Class Object

2010-02-13 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Michael Sparks: [Due to the appearance of reasoned discussion (it's not practical to read it all!) [...] Therefore to say "in reality the implementation will be passing a reference or pointer" is invalid. There is after all at least one implementation

Re: Hashing in python

2010-02-13 Thread MRAB
Vish wrote: Hi, I need to hash 3d coordinates to a grid which has been divided into 4*4*4 squares. Using python, I thought of a simple way as follows: CELL_SIZE = 4 def key(point): return ( int((floor(point[0]/CELL_SIZE))*CELL_SIZE), int((floor(point[1]/CELL_SIZE))*CELL_SI

Re: Modifying Class Object

2010-02-13 Thread Steven D'Aprano
On Sat, 13 Feb 2010 07:59:42 -0800, Michael Sparks wrote: > Now, if I define a language, this has 3 main parts: >* Syntax >* Semantics >* Implementation [snip] Michael, that is remarkable. Excellent work, thank you! -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Modifying Class Object

2010-02-13 Thread Steve Holden
Alf P. Steinbach wrote: > * Michael Sparks: > [Due to the appearance of reasoned discussion (it's not practical to read it > all!) [...] >> Therefore to say "in reality the implementation will be passing a >> reference or pointer" is invalid. There is after all at least one >> implementation that

Hashing in python

2010-02-13 Thread Vish
Hi, I need to hash 3d coordinates to a grid which has been divided into 4*4*4 squares. Using python, I thought of a simple way as follows: CELL_SIZE = 4 def key(point): return ( int((floor(point[0]/CELL_SIZE))*CELL_SIZE), int((floor(point[1]/CELL_SIZE))*CELL_SIZE), i

Re: Modifying Class Object

2010-02-13 Thread Alf P. Steinbach
* Michael Sparks: [Due to the appearance of reasoned discussion (it's not practical to read it all!), I felt it necessary to respond. It turned out to be a long sequence of trivial fallacies, peppered with various allegations and insinuations.] [snip extremely much] Now let's move to the

Re: Py3: Terminal or browser output?

2010-02-13 Thread John Bokma
Gnarlodious writes: > Hello, searched all over but no success. I want to have a script > output HTML if run in a browser and plain text if run in a Terminal. > In Python 2, I just said this: > > if len(sys.argv)==True: > > and it seemed to work. Py3 must have broken that by sending a list > with

Re: multiprocessing and games

2010-02-13 Thread Brian Blais
On Feb 13, 2010, at 12:54 , MRAB wrote: Brian Blais wrote: I've been thinking about implementing some simple games Forget about global variables, they're not worth it! :-) Think in terms of messages, sent via pipes, sockets or multiprocessing queues. okay...let's make this concrete. gi

Re: Py3: Terminal or browser output?

2010-02-13 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gnarlodious wrote: > I want to have a script > output HTML if run in a browser and plain text if run in a Terminal. You may also want to look into urwid. It provides you with a text console interface but can also provide HTML. It has widgets like te

Re: python and http POST

2010-02-13 Thread galileo228
Thank you all for your responses, and Javier thank you for your longer response. I've just downloaded mechanize and beautifulsoup and will start to play around. >From a pure learning standpoint, however, I'd really like to learn how to use the python post method (without mechanize) to go to a webp

Re: Py3: Terminal or browser output?

2010-02-13 Thread Gnarlodious
On Feb 13, 1:17 pm, "Diez B. Roggisch" wrote: > However, maybe > > if os.isatty(sys.stdout.fileno()): OK, this works in Python 2: #!/usr/bin/python import sys, os if __name__=="__main__": if os.isatty(sys.stdout.fileno()): print "Terminal" else: print "Content-type:text/html\n\nBROWSER"

Re: Py3: Terminal or browser output?

2010-02-13 Thread Diez B. Roggisch
Am 13.02.10 20:46, schrieb Gnarlodious: Hello, searched all over but no success. I want to have a script output HTML if run in a browser and plain text if run in a Terminal. In Python 2, I just said this: if len(sys.argv)==True: and it seemed to work. Py3 must have broken that by sending a list

Re: python and http POST

2010-02-13 Thread galileo228
Thank you all for your responses, and Javier thank you for your longer response. I've just downloaded mechanize and beautifulsoup and will start to play around. >From a pure learning standpoint, however, I'd really like to learn how to use the python post method (without mechanize) to go to a webp

Re: Py3: Terminal or browser output?

2010-02-13 Thread Chris Rebert
On Sat, Feb 13, 2010 at 11:46 AM, Gnarlodious wrote: > Hello, searched all over but no success. I want to have a script > output HTML if run in a browser and plain text if run in a Terminal. > In Python 2, I just said this: > > if len(sys.argv)==True: That line doesn't make sense really as it is

Re: python and http POST

2010-02-13 Thread galileo228
Thank you all for your responses, and Javier thank you for your longer response. I've just downloaded mechanize and beautifulsoup and will start to play around. >From a pure learning standpoint, however, I'd really like to learn how to use the python post method (without mechanize) to go to a webp

Re: how to make a SimpleXMLRPCServer abort at CTRL-C under windows

2010-02-13 Thread News123
Hi Gabriel, News123 wrote: > Hi Gabriel, > > Gabriel Genellina wrote: >> En Fri, 05 Feb 2010 20:03:51 -0300, News123 escribió: >> >>> I'm using an XMLRPC server under Windows. >>> >>> What I wonder is how I could create a server, that can be killed with >>> CTRL-C >>> >>> The server aborts ea

Py3: Terminal or browser output?

2010-02-13 Thread Gnarlodious
Hello, searched all over but no success. I want to have a script output HTML if run in a browser and plain text if run in a Terminal. In Python 2, I just said this: if len(sys.argv)==True: and it seemed to work. Py3 must have broken that by sending a list with the path to the script in BOTH the b

MemoryError in imaplib?

2010-02-13 Thread Márcio Faustino
Hi, When using "imaplib" to fetch e-mail messages, the "IMAP4_SSL.read" and "IMAP4_SSL.readline" functions sometimes throw a "MemoryError" exception in "chunks.append(data)" and "line.append(char)", respectively. But if I change those functions to use instead a "cStringIO" buffer object, then that

Re: MemoryError, can I use more?

2010-02-13 Thread Anssi Saari
"Diez B. Roggisch" writes: > Am 13.02.10 17:18, schrieb Anssi Saari: >> Nobody writes: >> >>> A single process can't use much more than 2GiB of RAM without a 64-bit CPU >>> and OS. >> >> That's not really true. Even Windows XP has the /3GB boot option to >> allow 3 GiB per process. On PCs, free

Re: multiprocessing and games

2010-02-13 Thread MRAB
Brian Blais wrote: Hello, I've been thinking about implementing some simple games, where one can program agents to play the game. I thought that the multiprocessing module would be perfect for it, organized with a main simulator engine spawning processes for each agent. However, I am having

Re: threading and signals - main thread solely responsible for signal handling?

2010-02-13 Thread exarkun
On 04:43 pm, malig...@gmail.com wrote: The main part of my script is a function that does many long reads (urlopen, it's looped). Since I'm hell-bent on employing SIGINFO to display some stats, I needed to run foo() as a seperate thread to avoid getting errno 4 (interrupted system call) errors (w

Re: threading and signals - main thread solely responsible for signal handling?

2010-02-13 Thread MRAB
Maligree wrote: The main part of my script is a function that does many long reads (urlopen, it's looped). Since I'm hell-bent on employing SIGINFO to display some stats, I needed to run foo() as a seperate thread to avoid getting errno 4 (interrupted system call) errors (which occur if SIGINFO i

multiprocessing and games

2010-02-13 Thread Brian Blais
Hello, I've been thinking about implementing some simple games, where one can program agents to play the game. I thought that the multiprocessing module would be perfect for it, organized with a main simulator engine spawning processes for each agent. However, I am having trouble wrappi

threading and signals - main thread solely responsible for signal handling?

2010-02-13 Thread Maligree
The main part of my script is a function that does many long reads (urlopen, it's looped). Since I'm hell-bent on employing SIGINFO to display some stats, I needed to run foo() as a seperate thread to avoid getting errno 4 (interrupted system call) errors (which occur if SIGINFO is received while u

Re: how do I write a scliceable class?

2010-02-13 Thread Robert Kern
On 2010-02-13 06:51 , Ernest Adrogué wrote: Hello everybody, I'm designing a container class that supports slicing. The problem is that I don't really know how to do it. class MyClass(object): def __init__(self, input_data): self._data = transform_input(input_data)

Re: Modifying Class Object

2010-02-13 Thread Alf P. Steinbach
* Aahz: In article , Steve Holden wrote: Whether in CPython, Jython or IronPython the value returned by calling id(x) (whether x is a literal, a simple name or a more complex expression) is absolutely no use as an accessor: it does not give you access to the referenced value. If you disagree,

Re: Modifying Class Object

2010-02-13 Thread Michael Sparks
Hi Alf, On Feb 12, 8:22 pm, "Alf P. Steinbach" wrote: > Thanks for the effort at non-flaming discussion, it *is* > appreciated. I would appreciate it if you tried to be non-flaming yourself, since you can see I am not flaming you. I was seeking to educate you on a simple matter which you seem

Re: Modifying Class Object

2010-02-13 Thread Aahz
In article , Dennis Lee Bieber wrote: >On Fri, 12 Feb 2010 18:23:46 -0800 (PST), rantingrick > declaimed the following in >gmane.comp.python.general: >> >> This entire thread has imploded like a neutron star into an infantile >> debate that only Caddie Couric, Bill O Reilly, and everyone on PMS-N

Re: Modifying Class Object

2010-02-13 Thread Aahz
In article , Steve Holden wrote: > >Whether in CPython, Jython or IronPython the value returned by calling >id(x) (whether x is a literal, a simple name or a more complex >expression) is absolutely no use as an accessor: it does not give you >access to the referenced value. > >If you disagree, pl

Re: Create a backslash-escaped version of a string?

2010-02-13 Thread Aahz
In article , boblatest wrote: > >I'd like to have control characters in a string to be converted to >their backslash-escaped counterparts. I looked in the encoders section >of the string module but couldn't find anything appropriate. I could >write it myself but I'm sure something of the sort exi

Re: concatenate fasta file

2010-02-13 Thread Grant Edwards
On 2010-02-12, PeroMHC wrote: > Hi All, I have a simple problem that I hope somebody can help with. I > have an input file (a fasta file) that I need to edit.. > > Input file format > >>name 1 > tactcatacatac >>name 2 > acggtggcat >>name 3 > gggtaccacgtt > > I need to concatenate the sequences..

Re: how do I write a scliceable class?

2010-02-13 Thread Ernest Adrogué
Hi, Thanks a lot for your comments. I think I've got enough information to make a decision now. 13/02/10 @ 15:16 (+0100), thus spake Peter Otten: > Ernest Adrogué wrote: > > > I'm designing a container class that supports slicing. > > The problem is that I don't really know how to do it. > > >

Re: how do I write a scliceable class?

2010-02-13 Thread Peter Otten
Ernest Adrogué wrote: > I'm designing a container class that supports slicing. > The problem is that I don't really know how to do it. > > class MyClass(object): > def __init__(self, input_data): > self._data = transform_input(input_data) > def __getitem__(self, ke

Re: how do I write a scliceable class?

2010-02-13 Thread Diez B. Roggisch
Am 13.02.10 13:51, schrieb Ernest Adrogué: Hello everybody, I'm designing a container class that supports slicing. The problem is that I don't really know how to do it. class MyClass(object): def __init__(self, input_data): self._data = transform_input(input_data)

Re: Function attributes [OT]

2010-02-13 Thread Mark Lawrence
Steve Holden wrote: Mark Lawrence wrote: Gabriel Genellina wrote: En Fri, 12 Feb 2010 04:29:12 -0300, Arnaud Delobelle escribió: I posted an example of a decorator that does just this in this thread a couple of days ago: http://mail.python.org/pipermail/python-list/2010-February/1235742.htm

Re: how do I write a scliceable class?

2010-02-13 Thread Alf P. Steinbach
* Ernest Adrogué: Hello everybody, I'm designing a container class that supports slicing. The problem is that I don't really know how to do it. class MyClass(object): def __init__(self, input_data): self._data = transform_input(input_data) def __getitem__(self, k

Re: Function attributes [OT]

2010-02-13 Thread Steve Holden
Mark Lawrence wrote: > Gabriel Genellina wrote: >> En Fri, 12 Feb 2010 04:29:12 -0300, Arnaud Delobelle >> escribió: >> >>> I posted an example of a decorator that does just this in this thread a >>> couple of days ago: >>> >>> http://mail.python.org/pipermail/python-list/2010-February/1235742.htm

Re: python crash on windows but not on linux

2010-02-13 Thread Dave Angel
hjebbers wrote: On Feb 13, 10:25 am, Dennis Lee Bieber wrote: On Fri, 12 Feb 2010 09:21:07 -0800 (PST), hjebbers declaimed the following in gmane.comp.python.general: What strikes me is: 1. the crash on windows, but linux works OK (same test sets) 2. the linux box has 750Mb RAM, the

how do I write a scliceable class?

2010-02-13 Thread Ernest Adrogué
Hello everybody, I'm designing a container class that supports slicing. The problem is that I don't really know how to do it. class MyClass(object): def __init__(self, input_data): self._data = transform_input(input_data) def __getitem__(self, key):

Re: python crash on windows but not on linux

2010-02-13 Thread hjebbers
On Feb 13, 10:25 am, Dennis Lee Bieber wrote: > On Fri, 12 Feb 2010 09:21:07 -0800 (PST), hjebbers > declaimed the following in gmane.comp.python.general: > > > What strikes me is: > > 1. the crash on windows, but linux works OK (same test sets) > > 2. the linux box has 750Mb RAM, the windows box

Re: python crash on windows but not on linux

2010-02-13 Thread Alf P. Steinbach
* hjebbers: I enlarged the windows page file from 750Kb to 1.5Gb . The crash still happens. btw, the crash does not happen at a peak memory usage. According to windows task manager, at the moment of crash mem usage of my program is 669kb, peak memory usage is 1.136kb henk-jan Probably you mean

Re: python crash on windows but not on linux

2010-02-13 Thread hjebbers
On Feb 13, 12:24 pm, "Diez B. Roggisch" wrote: > Am 13.02.10 11:50, schrieb hjebbers: > > > > > On Feb 13, 10:25 am, Dennis Lee Bieber  wrote: > >> On Fri, 12 Feb 2010 09:21:07 -0800 (PST), hjebbers > >> declaimed the following in gmane.comp.python.general: > > >>> What strikes me is: > >>> 1. the

Re: python crash on windows but not on linux

2010-02-13 Thread Diez B. Roggisch
Am 13.02.10 11:50, schrieb hjebbers: On Feb 13, 10:25 am, Dennis Lee Bieber wrote: On Fri, 12 Feb 2010 09:21:07 -0800 (PST), hjebbers declaimed the following in gmane.comp.python.general: What strikes me is: 1. the crash on windows, but linux works OK (same test sets) 2. the linux box has 750

Re: python crash on windows but not on linux

2010-02-13 Thread hjebbers
to all, thanks for the pointers so far. if you feel the need to reproduce the crash, it's not that hard, (downloading and installing my edi translator, install configuration (button-click), and run. I have a modified version (replace some *.py files) that eliminate a lot of stuff (simpler setup, n

Re: Function attributes

2010-02-13 Thread Mark Lawrence
Gabriel Genellina wrote: En Fri, 12 Feb 2010 04:29:12 -0300, Arnaud Delobelle escribió: I posted an example of a decorator that does just this in this thread a couple of days ago: http://mail.python.org/pipermail/python-list/2010-February/1235742.html Ouch! I didn't see your post, nor seve

Re: python crash on windows but not on linux

2010-02-13 Thread hjebbers
On Feb 13, 10:25 am, Dennis Lee Bieber wrote: > On Fri, 12 Feb 2010 09:21:07 -0800 (PST), hjebbers > declaimed the following in gmane.comp.python.general: > > > What strikes me is: > > 1. the crash on windows, but linux works OK (same test sets) > > 2. the linux box has 750Mb RAM, the windows box

Re: python crash on windows but not on linux

2010-02-13 Thread hjebbers
On Feb 13, 11:03 am, Peter Otten <__pete...@web.de> wrote: > hjebbers wrote: > > On Feb 12, 3:17 pm, Peter Otten <__pete...@web.de> wrote: > >> hjebbers wrote: > >> > On Feb 11, 7:01 pm, Peter Otten <__pete...@web.de> wrote: > >> >> hjebbers wrote: > >> >> > On Feb 11, 5:45 pm, M3RT wrote: > >> >>

Re: python crash on windows but not on linux

2010-02-13 Thread hjebbers
On Feb 12, 11:46 pm, Rob Williscroft wrote: > hjebbers wrote in news:2864756a-292b-4138-abfd- > 3348b72b7...@u9g2000yqb.googlegroups.com in comp.lang.python: > > > the information about the error is a windows dump. > > This may help: > > #http://msdn.microsoft.com/en-us/library/ms680621(VS.85).asp

bsddb version mysmatch between win32 and linux

2010-02-13 Thread Expo
Hi guys, I found an incompatibility in the bsddb library shipped with Python which is a different version between the win32 release and the linux release. This happend using Python 2.6.2 on win32 and OpenSuse 11.2. To reproduce this problem, create a bsddb file under win32 with this code: import

Re: python crash on windows but not on linux

2010-02-13 Thread Peter Otten
hjebbers wrote: > On Feb 12, 3:17 pm, Peter Otten <__pete...@web.de> wrote: >> hjebbers wrote: >> > On Feb 11, 7:01 pm, Peter Otten <__pete...@web.de> wrote: >> >> hjebbers wrote: >> >> > On Feb 11, 5:45 pm, M3RT wrote: >> >> >> The problem may be related to how you treat the EDI file or lets >>

plugin / intra process communication system

2010-02-13 Thread Florian Ludwig
Hi, I'm looking for a module/plugin/intra-process-communication/hook system for python. Maybe someone here could point me to some project I missed or might have some good ideas if I end up implementing it myself. Most systems I have found are "one to many" communications but I would like "many to

Re: Function attributes

2010-02-13 Thread Steve Howell
On Feb 10, 5:59 am, Muhammad Alkarouri wrote: > Hi everyone, > > What is the simplest way to access the attributes of a function from > inside it, other than using its explicit name? > In a function like f below: > > def f(*args): >     f.args = args >     print args > > is there any other way? >

  1   2   >