ANN: pypi-grep, grep a local file of PyPI info

2009-06-08 Thread denis
An example first: pypi-grep 'pyqt' -- # day status packagename version homepage summary 2009-06-07 3 pydee 0.4.11 http://code.google.com/p/pydee/ Pydee development environment and its PyQt4-based IDE tools: ... 2009-06-05 4 Sandbox 0.9.5

Jython 2.5.0 Release Candidate 4 is out!

2009-06-08 Thread Frank Wierzbicki
On behalf of the Jython development team, I'm pleased to announce that Jython 2.5rc4 is available for download: http://downloads.sourceforge.net/jython/jython_installer-2.5rc4.jar See http://www.jython.org/Project/installation.html for installation instructions. This is the fourth and probably

Re: unladen swallow: python and llvm

2009-06-08 Thread Kay Schluehr
On 8 Jun., 00:31, bearophileh...@lycos.com wrote: ShedSkin (SS) is a beast almost totally different from CPython, SS compiles an implicitly static subset of Python to C++. So it breaks most real Python programs, and it doesn't use the Python std lib (it rebuilds one in C++ or compiled

Re: unladen swallow: python and llvm

2009-06-08 Thread Tim Wintle
On Sun, 2009-06-07 at 16:40 -0600, Brian wrote: On Fri, Jun 5, 2009 at 3:29 AM, Nick Craig-Wood n...@craig-wood.com wrote: It is an interesting idea for a number of reasons, the main one as far as I'm concerned is that it is more of a port of CPython to a new

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-08 Thread higer
Thank you Mark, that works. Firstly using 'string-escape' to decode the content is the key point,so I can get the Chinese characters now. Regards, -higer -- http://mail.python.org/mailman/listinfo/python-list

Re: Making the case for repeat

2009-06-08 Thread Steven D'Aprano
On Sun, 07 Jun 2009 16:46:23 -0700, Raymond Hettinger wrote: We factor code to eliminate redundancy, but that is not always a good idea with an API. The goal for code factoring is to minimize redundancy. The goal for API design is having simple parts that are easily learned and can be

Re: Making the case for repeat

2009-06-08 Thread Ben Finney
Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Sun, 07 Jun 2009 16:46:23 -0700, Raymond Hettinger wrote: We factor code to eliminate redundancy, but that is not always a good idea with an API. The goal for code factoring is to minimize redundancy. The goal for API design

Re: multi-core software

2009-06-08 Thread Piet van Oostrum
By the way, there is a series of articles about concurrency on ACM Queue which may be interesting for those participating in or just following this discussion: http://queue.acm.org/listing.cfm?item_topic=Concurrencyqc_type=theme_listfilter=Concurrencypage_title=Concurrency Here is one

Re: Making the case for repeat

2009-06-08 Thread jkn
On Jun 8, 9:30 am, Ben Finney ben+pyt...@benfinney.id.au wrote: [...] As originally defined by Martin Fowler, re-factoring always means the external behaviour is unchanged URL:http://refactoring.com/. So, there's no such thing as a re-factoring that changes the API. Anything that changes an

Re: Making the case for repeat

2009-06-08 Thread Steven D'Aprano
On Mon, 08 Jun 2009 18:30:37 +1000, Ben Finney wrote: Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Sun, 07 Jun 2009 16:46:23 -0700, Raymond Hettinger wrote: We factor code to eliminate redundancy, but that is not always a good idea with an API. The goal for code

Re: Making the case for repeat

2009-06-08 Thread jkn
Possibly a *factoring*, without the re-, just like Raymond said. Also, keep in mind that when creating a new API, you have no existing API to re-factor. Exactly. I think this has come up before, but I can't remember the answers; any suggestions for pointer to examples of very well-designed

Re: unladen swallow: python and llvm

2009-06-08 Thread bearophileHUGS
Kay Schluehr: Don't understand your Cython compliant. The only tricky part of Cython is the doublethink regarding Python types and C types. I attempted once to write a ShedSkin like code transformer from Python to Cython based on type recordings but never found the time for this because I have

Re: can it be shorter?

2009-06-08 Thread Aaron Brady
On Jun 7, 6:13 pm, Paul Rubin http://phr...@nospam.invalid wrote: Aaron Brady castiro...@gmail.com writes: url+= { '/': '' }.get( url[ -1 ], '/' ) Shorter is always better. url = url.rstrip('/') + '/' I was joking. Sheesh. -- http://mail.python.org/mailman/listinfo/python-list

urllib2.URLError: urlopen error unknown url type: 'http error using twill with python

2009-06-08 Thread Mark Devine
Hi I wonder if someone could point me in the right direction. I used the following code to access gmail but I got a urllib2.URLError: urlopen error unknown url type: 'http error when I ran it. I have included the Traceback import twill, string, os b=twill.commands.get_browser()

Re: pylint naming conventions?

2009-06-08 Thread Esmail
Hi David, David Stanek wrote: It is my understanding that it does check for PEP8 names. Even if it doesn't it is really easy to change. If you run 'pylint --generate-rcfile' (i think) it will output the configuration that it is using. You can then save this off and customize it. Thanks, I'll

Re: pylint naming conventions?

2009-06-08 Thread Esmail
Ben Finney wrote: My understanding of Esmail's original message was that, like many of us on first running ‘pylint’ against an existing code base, the output is astonishingly verbose and tedious to read. By the above I presume he's being a good forum member and trying to find a minimal example

Re: urllib2.URLError: urlopen error unknown url type: 'http error using twill with python

2009-06-08 Thread Steven D'Aprano
On Mon, 08 Jun 2009 12:14:18 +0100, Mark Devine wrote: Hi I wonder if someone could point me in the right direction. I used the following code to access gmail but I got a urllib2.URLError: urlopen error unknown url type: 'http error when I ran it. I have included the Traceback

Re: 403 error for python webpage

2009-06-08 Thread Roland Mueller
2009/6/7 Daniel danwgr...@gmail.com I created a page with a .py extension but the browser does not like it. Here is what I did: I edited httpd.conf file and added the line: AddHandler cgi-script .cgi .py Then I stopped and restarted apache. Next I created a hello world file as on this page:

Re: Python preprosessor

2009-06-08 Thread Tuomas Vesterinen
R. David Murray wrote: Tuomas Vesterinen tuomas.vesteri...@iki.fi wrote: I am developing a Python application as a Python2.x and Python3.0 version. A common code base would make the work easier. So I thought to try a preprosessor. GNU cpp handles this kind of code correct: test_cpp.py #ifdef

Re: Python preprosessor

2009-06-08 Thread Tuomas Vesterinen
Roger Binns wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tuomas Vesterinen wrote: I am intensively using 2to3.py. So I have 2 codebase: one in py2 and the other in py3. The expectation would be that you only maintain the py2 code and automatically generate the py3 code on demand

Re: can it be shorter?

2009-06-08 Thread Roland Mueller
2009/6/8 Aaron Brady castiro...@gmail.com On Jun 7, 6:13 pm, Paul Rubin http://phr...@nospam.invalid wrote: Aaron Brady castiro...@gmail.com writes: url+= { '/': '' }.get( url[ -1 ], '/' ) Shorter is always better. url = url.rstrip('/') + '/' I was joking. Sheesh. --

Re: spammers on pypi

2009-06-08 Thread Skip Montanaro
On Jun 5, 1:39 pm, joep josef.p...@gmail.com wrote: Is there a way to ban spammers from pypi? Can you provide some examples? It's possible that we can apply SpamBayes to PyPI submissions in much the same way that we apply it in other non- mail areas. Thx, Skip Montanaro --

Wrapping LabVIEW and DAQmx Libraries for Python

2009-06-08 Thread xkenneth
All, I've started wrapping the DAQmx and other LabVIEW libraries for python using ctypes. I really like doing some things in python and other in LabVIEW, so I'd like to have the same functionality available for both. I've hosted the tiniest bit of code (mostly just proof of concept) on

Re: unladen swallow: python and llvm

2009-06-08 Thread skip
bearophile I'm sure lot of people like Cython, but I prefer a more bearophile transparent language, that doesn't hide me how it works bearophile inside. Why not just write extension modules in C then? -- Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/ America's

Re: interval arithmetic libraries

2009-06-08 Thread pruebauno
On Jun 6, 8:15 am, srepmub mark.duf...@gmail.com wrote: Hi all, I'm looking for libraries that allow one to calculate with sets of (date) intervals. So for example, I'd like to be able to calculate the overlap between two sets of intervals, the union etc. Preferrably, this works with

Re: unladen swallow: python and llvm

2009-06-08 Thread Paul Boddie
On 8 Jun, 12:13, bearophileh...@lycos.com wrote: The C code produced by ShedSkin is a bit hairy but it's 50 times more readable than the C jungle produced by Pyrex, where I have lost lot of time looking for the missing reference counts, etc. The C++ code produced by Shed Skin can actually

Re: multi-core software

2009-06-08 Thread Paul Wallich
rossb...@mpi-sws.org wrote: On Jun 8, 6:28 am, Ken T. nowh...@home.com wrote: Let's not forget Elite for the 6502 exploiting predictable performance in order to switch graphics modes partway down the vsync! That actually didn't require predictable timing. You could tell the video chip to send

10 Easy Steps to Speed Up Your Computer - Without Upgrading

2009-06-08 Thread youssef_edward3...@yahoo.com
It seems that the longer you own your computer, the slower it gets! A lot of people will keep their computer until it gets so slow that they feel they need a newer, faster model. Some feel like the reason it is getting slower is because it is getting older, when that is just not the case. Your

Career Track: Computer Programmer

2009-06-08 Thread youssef_edward3...@yahoo.com
Roles and Responsibilities : The primary role of a Computer Programmer is to write programs according to the instructions determined primarily by computer software engineers and systems analysts. In a nutshell, Computer Programmers are the ones that take the completed designs and convert them

Re: can it be shorter?

2009-06-08 Thread Jean-Michel Pichavant
Aaron Brady wrote: Shorter is always better. url+= { '/': '' }.get( url[ -1 ], '/' ) Why bother with spaces or 3 letter-wide token, check this :o) : x+={'/':''}.get(x[-1],'/') Apart from joking, the following proposed solution is by **far** the one I prefer if not url.endswith('/'):

is there python image lib that does imagemagick?

2009-06-08 Thread Xah Lee
is there a python image library that does pretty much what imagemagick does? all i need is for converting png/jpg, and scaling images. No need other fancy things imagemagick does. i know there's a python wrapper for imagemagick, but i need independent ones that doesn't require shell calls.

Re: The pysync library - Looking for the code, but all download links are broken

2009-06-08 Thread jpersson
Thanks for the help. I will let the community know as soon as I have salvaged a working copy. Cheers //Jan Persson On 7 Juni, 23:06, Søren - Peng - Pedersen pengmeis...@gmail.com wrote: I think what you are looking for can be found at:

Re: GD Library

2009-06-08 Thread Tim Harig
On 2009-06-08, Xah Lee xah...@gmail.com wrote: is there a python image library that does pretty much what imagemagick does? GD library has a Python binding: http://www.libgd.org/Main_Page -- http://mail.python.org/mailman/listinfo/python-list

Re: is there python image lib that does imagemagick?

2009-06-08 Thread Steven D'Aprano
On Mon, 08 Jun 2009 08:13:37 -0700, Xah Lee wrote: is there a python image library that does pretty much what imagemagick does? Python Imaging Library (PIL). http://pypi.python.org/pypi/PIL/1.1.6 -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL Python Imaging Library

2009-06-08 Thread Tim Harig
On 2009-06-08, Xah Lee xah...@gmail.com wrote: is there a python image library that does pretty much what imagemagick does? http://www.pythonware.com/products/pil/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Get the class name

2009-06-08 Thread Gary Herron
Kless wrote: Is there any way of to get the class name to avoid to have that write it? --- class Foo: super(Foo, self) --- * Using Py 2.6.2 The question does not make sense: to have WHAT write WHAT, and the code is wrong: the call to super fails But even

Re: can it be shorter?

2009-06-08 Thread MRAB
Jean-Michel Pichavant wrote: Aaron Brady wrote: Shorter is always better. url+= { '/': '' }.get( url[ -1 ], '/' ) Why bother with spaces or 3 letter-wide token, check this :o) : x+={'/':''}.get(x[-1],'/') Even shorter: x+='/'*(x[-1]!='/') Apart from joking, the following proposed

problems while using pexpect: pexcept.TIMEOUT always

2009-06-08 Thread Phoe6
I have been trying to use pexpect and I am failing with pexpect.TIMEOUT for all my attempts. In order to troubleshoot, I decided to go with simplest possible one. Here is my ssh to localhost: [21:29:14 senthil]$ssh localhost -l senthil sent...@localhost's password: sent...@ubuntu:~$ And here is

Extract value and average

2009-06-08 Thread Francesco Pietra
I come 'naked', which is unusual and unfair. However, I find it difficult to give a correct start. The files consist, among other things, of a huge number of blocks of the type NSTEP = 1000 TIME(PS) = 152.000 TEMP(K) = 298.54 PRESS =89.4 Etot = -134965.2123 EKtot =

Re: pyc-files contains absolute paths, is this a bug ?

2009-06-08 Thread Diez B. Roggisch
Stef Mientki wrote: hello, AFAIK I read that pyc files can be transferred to other systems. I finally got a windows executable working through py2exe, but still have some troubles, moving the directory around. I use Python 2.5.2. I use py2exe to make a distro I can unpack the distro,

Re: Extract value and average

2009-06-08 Thread MRAB
Francesco Pietra wrote: I come 'naked', which is unusual and unfair. However, I find it difficult to give a correct start. The files consist, among other things, of a huge number of blocks of the type NSTEP = 1000 TIME(PS) = 152.000 TEMP(K) = 298.54 PRESS =89.4 Etot =

Re: Extract value and average

2009-06-08 Thread Steven D'Aprano
On Mon, 08 Jun 2009 18:13:50 +0200, Francesco Pietra wrote: I come 'naked', which is unusual and unfair. ??? However, I find it difficult to give a correct start. The files consist, among other things, of a huge number of blocks of the type NSTEP = 1000 TIME(PS) = 152.000

Re: Extract value and average

2009-06-08 Thread Tim Chase
I would like to extract values corresponding to variable DIHED (here 4660.1650) and getting also the mean value from all DIHED. To just pull the DIHED values, you can use this: import re find_dihed_re = re.compile(r'\bDIHED\s*=\s*([.-e\d]+)', re.I) total = count = 0 for line in

Re: Extract value and average

2009-06-08 Thread MRAB
Steven D'Aprano wrote: On Mon, 08 Jun 2009 18:13:50 +0200, Francesco Pietra wrote: I come 'naked', which is unusual and unfair. ??? However, I find it difficult to give a correct start. The files consist, among other things, of a huge number of blocks of the type NSTEP = 1000

Re: Odd closure issue for generators

2009-06-08 Thread David Stanek
On Thu, Jun 4, 2009 at 7:42 PM, Scott David Danielsscott.dani...@acm.org wrote: Brian Quinlan wrote: This is from Python built from the py3k branch:   c = (lambda : i for i in range(11, 16))   for q in c: ...     print(q()) ... 11 12 13 14 15   # This is expected   c = (lambda : i

Re: Extract value and average

2009-06-08 Thread Rhodri James
On Mon, 08 Jun 2009 17:29:12 +0100, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Mon, 08 Jun 2009 18:13:50 +0200, Francesco Pietra wrote: I come 'naked', which is unusual and unfair. ??? Yeah, I had to go and scrub my brain out :-) Assuming no DIHED value will ever

problems while using pexpect: pexcept.TIMEOUT always

2009-06-08 Thread R. David Murray
Phoe6 orsent...@gmail.com wrote: I have been trying to use pexpect and I am failing with pexpect.TIMEOUT for all my attempts. In order to troubleshoot, I decided to go with simplest possible one. [...] Can someone help me what I am doing wrong here? Why is not working for such a simple

Re: Extract value and average

2009-06-08 Thread Scott David Daniels
Steven D'Aprano wrote: ... Assuming no DIHED value will ever be split over two lines: data = open(filename) values = [] for line in data: if line and line.strip(): # ignore blanks words = line.strip().split() words = line.split() # does the same as above try:

Re: pylint naming conventions?

2009-06-08 Thread R. David Murray
Esmail ebo...@hotmail.com wrote: Ben Finney wrote: My understanding of Esmail's original message was that, like many of us on first running ‘pylint’ against an existing code base, the output is astonishingly verbose and tedious to read. By the above I presume he's being a good forum

Re: problems while using pexpect: pexcept.TIMEOUT always

2009-06-08 Thread Senthil Kumaran
On Jun 8, 10:19 pm, R. David Murray rdmur...@bitdance.com wrote: I would suggest using the 'setlog' method of child to get more debugging information from pexpect.  I've found that the best way to diagnose the source of a timeout. setlog method seems to be deprecated and 'not allowed' too as

Am I doing this the python way? (list of lists + file io)

2009-06-08 Thread R. David Murray
Horace Blegg tkjthing...@gmail.com wrote: So, Example: I'll read in a CSV file (just one, for now.) and store it into a list. Sometime later, I'll get another CSV file, almost identical/related to the first. However, a few values might have changed, and there might be a few new lines (entries)

Re: multi-core software

2009-06-08 Thread Seamus MacRae
Piet van Oostrum wrote: By the way, there is a series of articles about concurrency on ACM Queue which may be interesting for those participating in or just following this discussion:

error: an integer is required

2009-06-08 Thread madigreece
I execute my code in linux environment. My code is: from os import * def insert_text_file(self, strng): t=open(elements_file.txt, a) t.write(strng) t.close() I'm getting this error: type 'exception.TypeError': an integer is required Where is the mistake? Help me, please!! --

Re: Extract value and average

2009-06-08 Thread Tim Chase
Tim Chase wrote: I would like to extract values corresponding to variable DIHED (here 4660.1650) and getting also the mean value from all DIHED. To just pull the DIHED values, you can use this: import re find_dihed_re = re.compile(r'\bDIHED\s*=\s*([.-e\d]+)', re.I) total = count = 0

Is it possible to disable readline in the interactive interpreter?

2009-06-08 Thread Paul Moore
I run Python on Windows. I have the (pure Python) pyreadline package installed for (occasional) use by IPython. However, when I use the normal Python interactive prompt, the mere fact that the readline module exists means that it gets used. Is there a way of disabling this? (Preferably by

Re: error: an integer is required

2009-06-08 Thread MRAB
madigre...@yahoo.gr wrote: I execute my code in linux environment. My code is: from os import * def insert_text_file(self, strng): t=open(elements_file.txt, a) t.write(strng) t.close() I'm getting this error: type 'exception.TypeError': an integer is required Where is the

Re: Is it possible to disable readline in the interactive interpreter?

2009-06-08 Thread Tim Golden
Paul Moore wrote: I run Python on Windows. I have the (pure Python) pyreadline package installed for (occasional) use by IPython. However, when I use the normal Python interactive prompt, the mere fact that the readline module exists means that it gets used. I used to get round this by

MD5 hash of object

2009-06-08 Thread lczancanella
Hi, in hashlib the hash methods have as parameters just string, i want to know how can i digest an object to get a md5 hash of them. Thankz Luiz -- http://mail.python.org/mailman/listinfo/python-list

Re: error: an integer is required

2009-06-08 Thread Terry Reedy
madigre...@yahoo.gr wrote: I execute my code in linux environment. My code is: from os import * def insert_text_file(self, strng): t=open(elements_file.txt, a) t.write(strng) t.close() I'm getting this error: type 'exception.TypeError': an integer is required Where is the

Re: Is it possible to disable readline in the interactive interpreter?

2009-06-08 Thread Paul Moore
On Jun 8, 7:31 pm, Tim Golden m...@timgolden.me.uk wrote: Paul Moore wrote: I run Python on Windows. I have the (pure Python) pyreadline package installed for (occasional) use by IPython. However, when I use the normal Python interactive prompt, the mere fact that the readline module

Re: spammers on pypi

2009-06-08 Thread Robert Kern
On 2009-06-08 07:44, Skip Montanaro wrote: On Jun 5, 1:39 pm, joepjosef.p...@gmail.com wrote: Is there a way to ban spammers from pypi? Can you provide some examples? It's possible that we can apply SpamBayes to PyPI submissions in much the same way that we apply it in other non- mail

Re: unladen swallow: python and llvm

2009-06-08 Thread bearophileHUGS
s...@pobox.com: Why not just write extension modules in C then? In the past I have used some C for that purpose, but have you tried the D language (used from Python with Pyd)? It's way better, especially if you for example use libs similar to itertools functions, etc :-) Bye, bearophile --

Re: Am I doing this the python way? (list of lists + file io)

2009-06-08 Thread bearophileHUGS
R. David Murray: Given your description, I don't see any reason to prefer any alternate data structure.  1000 small CSV files should fit in a modern computer's memory with no problem...and if it does become an issue, worry about it then. The OP can also try the diff command that can be found

Re: spammers on pypi

2009-06-08 Thread Robert Kern
On 2009-06-08 14:32, Jesse Noller wrote: On Mon, Jun 8, 2009 at 3:14 PM, Robert Kernrobert.k...@gmail.com wrote: On 2009-06-08 07:44, Skip Montanaro wrote: On Jun 5, 1:39 pm, joepjosef.p...@gmail.comwrote: Is there a way to ban spammers from pypi? Can you provide some examples? It's

Re: MD5 hash of object

2009-06-08 Thread Chris Rebert
On Mon, Jun 8, 2009 at 11:43 AM, lczancanellalczancane...@gmail.com wrote: Hi, in hashlib the hash methods have as parameters just string, i want to know how can i digest an object to get a md5 hash of them. Hashes are only defined to operate on bytestrings. Since Python is a high-level

Re: Wrapping LabVIEW and DAQmx Libraries for Python

2009-06-08 Thread Stef Mientki
hi Ketteth, I was waiting for someone, making these available. The hardware modules of NI are very good, and they have a huge range of DAQ cards, even relative cheap ones. We use USB 6009 and 9162 container a lot ( now in Delphi, because the lack of Python drivers :-( I took a biref look at

Re: is there python image lib that does imagemagick?

2009-06-08 Thread Michel Claveau - MVP
Hi! On Windows, you can drive (manage?) ImageMagick from Python, via COM. See: http://www.imagemagick.org/script/api.php#com+ @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: can it be shorter?

2009-06-08 Thread Aaron Brady
On Jun 8, 9:50 am, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Aaron Brady wrote: Shorter is always better. url+= { '/': '' }.get( url[ -1 ], '/' ) Why bother with spaces or 3 letter-wide token, check this  :o) : x+={'/':''}.get(x[-1],'/') Apart from joking, the following

Re: Get the class name

2009-06-08 Thread Jeff McNeil
On Jun 8, 11:33 am, Gary Herron gher...@islandtraining.com wrote: Kless wrote: Is there any way of to get the class name to avoid to have that write it? --- class Foo:    super(Foo, self) --- * Using Py 2.6.2 The question does not make sense:     to have

Re: pythoncom and writing file summary info on Windows

2009-06-08 Thread Tim Golden
mattleftb...@gmail.com wrote: Hello, I was trying to put together a script that would write things like the Author and Title metadata fields of a file under Windows. I got the win32 extensions installed and found a few things that look like they should work, though I'm not getting the result I

preferring [] or () in list of error codes?

2009-06-08 Thread mh
Is there any reason to prefer one or the other of these statements? if e.message.code in [25401,25402,25408]: if e.message.code in (25401,25402,25408): I'm currently using [], but only coz I think it's prettier than (). context: these are database errors and e is database

Re: preferring [] or () in list of error codes?

2009-06-08 Thread Stephen Hansen
On Mon, Jun 8, 2009 at 2:36 PM, m...@pixar.com wrote: Is there any reason to prefer one or the other of these statements? if e.message.code in [25401,25402,25408]: if e.message.code in (25401,25402,25408): I'm currently using [], but only coz I think it's prettier than ().

Re: preferring [] or () in list of error codes?

2009-06-08 Thread Scott David Daniels
m...@pixar.com wrote: Is there any reason to prefer one or the other of these statements? if e.message.code in [25401,25402,25408]: if e.message.code in (25401,25402,25408): I'm currently using [], but only coz I think it's prettier than (). context: these are database errors and

Re: preferring [] or () in list of error codes?

2009-06-08 Thread John Machin
mh at pixar.com writes: Is there any reason to prefer one or the other of these statements? if e.message.code in [25401,25402,25408]: if e.message.code in (25401,25402,25408): From the viewpoint of relative execution speed, in the above case if it matters at all it

Re: preferring [] or () in list of error codes?

2009-06-08 Thread Ben Finney
m...@pixar.com writes: Is there any reason to prefer one or the other of these statements? if e.message.code in [25401,25402,25408]: if e.message.code in (25401,25402,25408): I'm currently using [], but only coz I think it's prettier than (). Use a list when the semantic

Re: can it be shorter?

2009-06-08 Thread Steven D'Aprano
On Mon, 08 Jun 2009 12:57:58 -0700, Aaron Brady wrote: Why won't Python permit: url.endswith( '/' ) or url.append( '/' ) ? Because: (1) Strings are immutable, so that won't work. (2) Even if it did, you're programming by side-effect, which is bad style often leading to bugs, and so

Network Simulator

2009-06-08 Thread Ala
Hello everyone. I plan on starting to write a network simulator on python for testing a modified version of TCP. I am wondering if a python network simulator exists? Also, if anyone tried using simpy for doing a simulation. Thank you -- http://mail.python.org/mailman/listinfo/python-list

networking simulator on python

2009-06-08 Thread Ala
Hello everyone. I plan on starting to write a network simulator on python for testing a modified version of TCP. I am wondering if a python network simulator exists? Also, if anyone tried using simpy for doing a simulation. Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: preferring [] or () in list of error codes?

2009-06-08 Thread Carl Banks
On Jun 8, 4:43 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: m...@pixar.com writes: Is there any reason to prefer one or the other of these statements?         if e.message.code in [25401,25402,25408]:         if e.message.code in (25401,25402,25408): I'm currently using [], but only

Pyrex and refcounts (Re: unladen swallow: python and llvm)

2009-06-08 Thread greg
bearophileh...@lycos.com wrote: I have tried to create a certain data structure with a recent version of Pyrex on Windows, and I have wasted lot of time looking for missing reference count updates that didn't happen, or memory that didn't get freed. Can you elaborate on those problems? The

Re: networking simulator on python

2009-06-08 Thread Paul McGuire
On Jun 8, 7:18 pm, Ala shaib...@ymail.com wrote: Hello everyone. I plan on starting to write a network simulator on python for testing a modified version of TCP. I am wondering if a python network simulator exists? Also, if anyone tried using simpy for doing a simulation. Thank you There

Re: preferring [] or () in list of error codes?

2009-06-08 Thread Ben Finney
Carl Banks pavlovevide...@gmail.com writes: If you want to go strictly by the book, I would say he ought to be using a set since his collection of numbers has no meaningful order nor does it make sense to list any item twice. Yes, a set would be best for this specific situation. I don't

Re: unladen swallow: python and llvm

2009-06-08 Thread Neal Becker
bearophileh...@lycos.com wrote: s...@pobox.com: Why not just write extension modules in C then? In the past I have used some C for that purpose, but have you tried the D language (used from Python with Pyd)? It's way better, especially if you for example use libs similar to itertools

Any idea of stopping the execution of PyRun_File()

2009-06-08 Thread BigHand
Hi,All I have an embedded python application. which is a MFC app with Python interpreter embedded. In the App, I have a separate thread to execute a Python script (using the PyRun_File), but if the user want to stop the executing script, how should I do? A possible way is terminate the

Re: preferring [] or () in list of error codes?

2009-06-08 Thread Carl Banks
On Jun 8, 6:02 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Carl Banks pavlovevide...@gmail.com writes: If you want to go strictly by the book, I would say he ought to be using a set since his collection of numbers has no meaningful order nor does it make sense to list any item twice.

Re: multi-core software

2009-06-08 Thread rossberg
On Jun 8, 6:28 am, Ken T. nowh...@home.com wrote: Let's not forget Elite for the 6502 exploiting predictable performance in order to switch graphics modes partway down the vsync! That actually didn't require predictable timing.  You could tell the video chip to send you an interrupt when

Re: preferring [] or () in list of error codes?

2009-06-08 Thread samwyse
On Jun 8, 7:37 pm, Carl Banks pavlovevide...@gmail.com wrote: On Jun 8, 4:43 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: m...@pixar.com writes: Is there any reason to prefer one or the other of these statements?         if e.message.code in [25401,25402,25408]:         if

Re: Pyrex and refcounts (Re: unladen swallow: python and llvm)

2009-06-08 Thread bearophileHUGS
Greg: Can you elaborate on those problems? I can't, I am sorry, I don't remember the details anymore. Feel free to ignore what I have written about Pyrex, lot of people appreciate it, so it must be good enough, even if I was not smart/ expert enough to use it well. I have even failed in using it

Re: spammers on pypi

2009-06-08 Thread skip
Robert I don't think a SpamBayes approach will work for this particular Robert guy. It's not like completely fake metadata was uploaded with Robert links to spam sites. There actually is Python code for some of Robert them. Maybe even some that is marginally useful. But only

Unbound Method Error

2009-06-08 Thread lczancanella
Hi, i am brand new in Python, so sorry if this question is too basic, but i have tried a lot and dont have success... I have the following code... class Funcoes: def CifradorDeCesar(mensagem, chave, funcao): mensagem_encriptada='' if funcao == 1: for byte in

Re: Unbound Method Error

2009-06-08 Thread Chris Rebert
On Mon, Jun 8, 2009 at 7:23 PM, lczancanellalczancane...@gmail.com wrote: Hi, i am brand new in Python, so sorry if this question is too basic, but i have tried a lot and dont have success... I have the following code... class Funcoes:    def CifradorDeCesar(mensagem, chave, funcao):        

Re: preferring [] or () in list of error codes?

2009-06-08 Thread Charles Yeomans
On Jun 8, 2009, at 9:28 PM, Carl Banks wrote: On Jun 8, 6:02 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Carl Banks pavlovevide...@gmail.com writes: If you want to go strictly by the book, I would say he ought to be using a set since his collection of numbers has no meaningful order nor

Re: preferring [] or () in list of error codes?

2009-06-08 Thread Chris Rebert
On Mon, Jun 8, 2009 at 6:57 PM, samwysesamw...@gmail.com wrote: On Jun 8, 7:37 pm, Carl Banks pavlovevide...@gmail.com wrote: On Jun 8, 4:43 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: m...@pixar.com writes: Is there any reason to prefer one or the other of these statements?        

Re: preferring [] or () in list of error codes?

2009-06-08 Thread Steven D'Aprano
On Tue, 09 Jun 2009 11:02:54 +1000, Ben Finney wrote: Carl Banks pavlovevide...@gmail.com writes: If you want to go strictly by the book, I would say he ought to be using a set since his collection of numbers has no meaningful order nor does it make sense to list any item twice. Yes, a

Re: MD5 hash of object

2009-06-08 Thread Jeff McNeil
On Jun 8, 3:47 pm, Chris Rebert c...@rebertia.com wrote: On Mon, Jun 8, 2009 at 11:43 AM, lczancanellalczancane...@gmail.com wrote: Hi, in hashlib the hash methods have as parameters just string, i want to know how can i digest an object to get a md5 hash of them. Hashes are only defined

Re: preferring [] or () in list of error codes?

2009-06-08 Thread Ben Finney
Steven D'Aprano ste...@remove.this.cybersource.com.au writes: In addition, using a tuple or a list in this context: if e.message.code in (25401,25402,25408): is so idiomatic, that using a set in it's place would be distracting. I think a list in that context is fine, and that's the

Re: preferring [] or () in list of error codes?

2009-06-08 Thread Emile van Sebille
On 6/8/2009 8:43 PM Ben Finney said... Steven D'Aprano ste...@remove.this.cybersource.com.au writes: In addition, using a tuple or a list in this context: if e.message.code in (25401,25402,25408): is so idiomatic, that using a set in it's place would be distracting. I think a list in

multi-thread python interpreaters and c++ program

2009-06-08 Thread myopc
hi, all I am ruuning a c++ program (boost python) , which create many python interpreaters and each run a python script with use multi-thread (threading). when the c++ main program exit, I want to shut down python interpreaters, but it crashed. I have googled a lot but cant get any clue.

[issue6235] \d missing from effects of re.ASCII flag

2009-06-08 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Thanks, fixed in r73285. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6235 ___

[issue2947] subprocess (Replacing popen) - add a warning / hint

2009-06-08 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Patch looks good, except for strange code indentation in the replaced example. -- assignee: georg.brandl - r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2947

  1   2   >