Re: Question to python C API

2009-04-16 Thread Andreas Otto
Hi, I want to make a language binding for an existing C library http://libmsgque.sourceforge.net is this possible ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to find options for add_command?

2009-04-16 Thread Eric Brunel
Muddy Coder wrote: Hi Folks, When I make Menu, and add in menu items, by using add_command, such as: menuObj.add_command(label='Open File', command=self.open_file) It works. But, I want to make the GUI looking better. So, I want to change color, font, size, background, for the label of

Re: HTML Generation

2009-04-16 Thread Nick Craig-Wood
J Kenneth King ja...@agentultra.com wrote: Stefan Behnel stefan...@behnel.de writes: See here for another example that uses lxml.html: http://codespeak.net/lxml/lxmlhtml.html#creating-html-with-the-e-factory Stefan Ah, looks good. Have never used nor finished the example I had

Re: Best way to extract from regex in if statement

2009-04-16 Thread Nick Craig-Wood
Paul McGuire pt...@austin.rr.com wrote: On Apr 3, 9:26 pm, Paul Rubin http://phr...@nospam.invalid wrote: bwgoudey bwgou...@gmail.com writes: elif re.match(^DATASET:\s*(.+) , line):         m=re.match(^DATASET:\s*(.+) , line)         print m.group(1)) Sometimes I like to make a

Re: interacting with an updatedb generated data file within python

2009-04-16 Thread Nick Craig-Wood
birdsong david.birds...@gmail.com wrote: Does anybody have any recommendations on how to interact with the data file that updatedb generates? I'm running through a file list in sqlite that I want to check against the file system. updatedb is pretty optimized for building an index and

Re: Question to python C API

2009-04-16 Thread Ben Kaplan
On Apr 16, 2009, at 1:53 AM, Andreas Otto aotto1...@onlinehome.de wrote: Hi, I want to make a language binding for an existing C library http://libmsgque.sourceforge.net is this possible ? -- Not only is itpossible, it's pretty common. All of the major GUI toolkits do this.

Re: PEP 382: Namespace Packages

2009-04-16 Thread syt
On Apr 14, 6:27 pm, P.J. Eby p...@telecommunity.com wrote: I think you've misunderstood something about the use case.  System packaging tools don't like separate packages to contain the *same file*.  That means that they *can't* split a larger package up with your proposal, because every one

Re: binary file compare...

2009-04-16 Thread Adam Olsen
On Apr 15, 12:56 pm, Nigel Rantor wig...@wiggly.org wrote: Adam Olsen wrote: The chance of *accidentally* producing a collision, although technically possible, is so extraordinarily rare that it's completely overshadowed by the risk of a hardware or software failure producing an incorrect

Re: ANN: PyGUI 2.0.1

2009-04-16 Thread fyaqq
On 4月16日, 上午3时05分, Suraj Barkale su...@barkale.com wrote: Greg Ewing greg.ewing at canterbury.ac.nz writes: PyGUI2.0.1 is available: Thank you very much for this GUI toolkit. I always wanted something like this on windows. I installed this and tried out the tests on Python 2.6.1 and

Re: Lambda alternative?

2009-04-16 Thread Duncan Booth
Paul Rubin http://phr...@nospam.invalid wrote: Duncan Booth duncan.bo...@invalid.invalid writes: dumped = dumps(air) t = loads(dumped) print t # works fine Hmm, well, that doesn't really pickle the function; it pickles a class instance that records where the class definition was and (on

Re: Developing modules with ‘pkgutil’

2009-04-16 Thread Peter Otten
Ben Finney wrote: At this point I'm stuck. I can't see how to have the ‘docutils/__init__.py’ stop shadowing the names in the system-installed ‘docutils/__init__.py’, while still doing the namespace shuffle necessary to have my in-development module appear part of the wider package

Re: Lambda alternative?

2009-04-16 Thread mousemeat
On 16 Apr, 09:39, Duncan Booth duncan.bo...@invalid.invalid wrote: Paul Rubin http://phr...@nospam.invalid wrote: Duncan Booth duncan.bo...@invalid.invalid writes: dumped = dumps(air) t = loads(dumped) print t # works fine Hmm, well, that doesn't really pickle the function; it pickles

Re: Interrupt Python C API

2009-04-16 Thread Piet van Oostrum
googler.1.webmas...@spamgourmet.com (g1w) wrote: g1w hi, yes, thats true, Alan Touring told us, so it would be nice to let g1w the user abort it. g1w Is there a chance for windows, too? I don't know. I have no access to Python on Windows. Maybe there is setitimer support on Windows. Or maybe

Re: How to check all elements of a list are same or different

2009-04-16 Thread Piet van Oostrum
John Machin sjmac...@lexicon.net (JM) wrote: JM On Apr 16, 8:14 am, Chris Rebert c...@rebertia.com wrote: def all_same(lst):     return len(set(lst)) == 1 def all_different(lst):     return len(set(lst)) == len(lst) JM @ OP: These are very reasonable interpretations of all same and all

compiler package vs parser

2009-04-16 Thread Robin Becker
Is the compiler package actually supposed to be equivalent to the parser module? I ask because the following code start p.py def func(D): for k in D: exec '%s=D[%r]' % (k,k) print i, j, k print locals() print i, j, k if __name__=='__main__':

Re: What IDE support python 3.0.1 ?

2009-04-16 Thread mousemeat
Use eclipse with the pydev module. I use python(x,y) which is a big bundle of most of the python stuff you could possibly want (including scientific stuff, but its not mandatory to use it) configured to work together. It uses python 2.5. You can have the best of both worlds. Search for 'from

Re: binary file compare...

2009-04-16 Thread Adam Olsen
On Apr 16, 3:16 am, Nigel Rantor wig...@wiggly.org wrote: Adam Olsen wrote: On Apr 15, 12:56 pm, Nigel Rantor wig...@wiggly.org wrote: Adam Olsen wrote: The chance of *accidentally* producing a collision, although technically possible, is so extraordinarily rare that it's completely

Re: How to check all elements of a list are same or different

2009-04-16 Thread Arnaud Delobelle
Piet van Oostrum p...@cs.uu.nl writes: John Machin sjmac...@lexicon.net (JM) wrote: JM On Apr 16, 8:14 am, Chris Rebert c...@rebertia.com wrote: def all_same(lst):     return len(set(lst)) == 1 def all_different(lst):     return len(set(lst)) == len(lst) JM @ OP: These are very

Re: binary file compare...

2009-04-16 Thread Nigel Rantor
Adam Olsen wrote: On Apr 16, 3:16 am, Nigel Rantor wig...@wiggly.org wrote: Adam Olsen wrote: On Apr 15, 12:56 pm, Nigel Rantor wig...@wiggly.org wrote: Adam Olsen wrote: The chance of *accidentally* producing a collision, although technically possible, is so extraordinarily rare that it's

Re: binary file compare...

2009-04-16 Thread Nigel Rantor
Adam Olsen wrote: On Apr 15, 12:56 pm, Nigel Rantor wig...@wiggly.org wrote: Adam Olsen wrote: The chance of *accidentally* producing a collision, although technically possible, is so extraordinarily rare that it's completely overshadowed by the risk of a hardware or software failure producing

Re: Question to python C API

2009-04-16 Thread Andreas Otto
Yes, you are right ... I read more and found the doc about this ... the problem I have is something more tricky ... I allready have an extension written for java and the easyest thing would be use this as template and replace the java specific calls with python calls ... but the

Re: Lambda alternative?

2009-04-16 Thread Hrvoje Niksic
mousemeat mousem...@gmail.com writes: Thank you for everyone's explanations, help and interest on this one. I have reworked my code as described and promised myself not to use lambdas ever again (i still think they are an elegant idea, but if they are incompatible with frequently used

Re: Interrupt Python C API

2009-04-16 Thread googler . 1 . webmaster
On 16 Apr., 11:08, Piet van Oostrum p...@cs.uu.nl wrote: googler.1.webmas...@spamgourmet.com (g1w) wrote: g1w hi, yes, thats true, Alan Touring told us, so it would be nice to let g1w the user abort it. g1w Is there a chance for windows, too? I don't know. I have no access to Python on

Re: Lambda alternative?

2009-04-16 Thread Aaron Brady
On Apr 16, 5:25 am, mousemeat mousem...@gmail.com wrote: On 16 Apr, 10:21, Hrvoje Niksic hnik...@xemacs.org wrote: mousemeat mousem...@gmail.com writes: Thank you for everyone's explanations, help and interest on this one.  I have reworked my code as described and promised myself not

Library/classes to burn DVDs given a set of .AVI files

2009-04-16 Thread Aldo Ceccarelli
Hi All, do you have any experience about any library tool suitable to burn video DVDs from video (f.i. .avi) file formats? In negative case and as an alternative: do you have any in other programming languages? thanks in advance WKR, Aldo -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda alternative?

2009-04-16 Thread mousemeat
On 16 Apr, 10:21, Hrvoje Niksic hnik...@xemacs.org wrote: mousemeat mousem...@gmail.com writes: Thank you for everyone's explanations, help and interest on this one.  I have reworked my code as described and promised myself not to use lambdas ever again (i still think they are an elegant

Is there any way to find out the definition of a function in a file of C language?

2009-04-16 Thread Jebel
Hi ,everyone. I have the name of a function of C language, and have the source file which the function is defined in. And I want to find out the type and name of the parameters. If I need to analyze the file by myself, or have some way to do it more easily? --

Re: Modifying the value of a float-like object

2009-04-16 Thread Eric . Le . Bigot
Th^H^H On Apr 16, 5:51 am, a...@pythoncraft.com (Aahz) wrote: In article 3b01d8f1-6a77-4374-b1c2-25bee7cdf...@x3g2000yqa.googlegroups.com,  eric.le.bi...@spectro.jussieu.fr wrote: Steven, I'd appreciate if you could refrain from criticizing so bluntly so many points.  I'd be great if you

Re: Lambda alternative?

2009-04-16 Thread Hrvoje Niksic
mousemeat mousem...@gmail.com writes: Correct me if i am wrong, but i can pickle an object that contains a bound method (it's own bound method). No, you can't: import cPickle as p p.dumps([]) '(l.' p.dumps([].append) Traceback (most recent call last): File stdin, line 1, in module

Re: get text from rogramms runn by subprocess.Popen immediatetly

2009-04-16 Thread Diez B. Roggisch
Rüdiger Ranft schrieb: Hi all, I need to call some programms and catch their stdout and stderr streams. While the Popen class from subprocess handles the call, I get the results of the programm not until the programm finishes. Since the output of the programm is used to generate a progress

Re: Equivalent to C bitmasks and enumerations

2009-04-16 Thread Dave Angel
John Machin wrote: On Apr 16, 10:13 am, Dave Angel da...@ieee.org wrote: For the Color example, how's this for a starting place: class Color(object): def __init__(self, name, enum): self.enum =num self.name =ame setattr(Color, name, self) @staticmethod

Re: What IDE support python 3.0.1 ?

2009-04-16 Thread Ryniek90
Temat: Re: What IDE support python 3.0.1 ? Od: Fabio Zadrozny fabi...@gmail.com Data: Wed, 15 Apr 2009 22:25:36 -0300 Do: Deep_Feelings doctore...@gmail.com Do: Deep_Feelings doctore...@gmail.com Kopia:

get text from rogramms runn by subprocess.Popen immediatetly

2009-04-16 Thread Rüdiger Ranft
Hi all, I need to call some programms and catch their stdout and stderr streams. While the Popen class from subprocess handles the call, I get the results of the programm not until the programm finishes. Since the output of the programm is used to generate a progress indicator, I need a way to

Re: Python interpreters in threads crash the application

2009-04-16 Thread Aahz
In article 74bec1d9-2109-4b9e-8e4d-541894a4d...@f41g2000pra.googlegroups.com, grbgooglefan ganeshbo...@gmail.com wrote: I have C application in which I have instantiated Python interpreter in each worker thread. When I start the program it crashes at different places in Python code but program

Re: get text from rogramms runn by subprocess.Popen immediatetly

2009-04-16 Thread Jeremiah Dodds
On Thu, Apr 16, 2009 at 12:12 PM, Rüdiger Ranft _r...@web.de wrote: Hi all, I need to call some programms and catch their stdout and stderr streams. While the Popen class from subprocess handles the call, I get the results of the programm not until the programm finishes. Since the output of

RE: get text from rogramms runn by subprocess.Popen immediatetly

2009-04-16 Thread Barak, Ron
Maybe try: p = Popen('./iodummy',stdin=PIPE, stdout=PIPE, stderr=PIPE).p (see 18.1.3.4. Replacing the os.spawn family in http://docs.python.org/library/subprocess.html) Bye, Ron. -Original Message- From: Rüdiger Ranft [mailto:_r...@web.de] Sent: Thursday, April 16, 2009 14:13

Re: Library/classes to burn DVDs given a set of .AVI files

2009-04-16 Thread Weinhandl Herbert
Aldo Ceccarelli schrieb: Hi All, do you have any experience about any library tool suitable to burn video DVDs from video (f.i. .avi) file formats? In negative case and as an alternative: do you have any in other programming languages? see :

Re: Re: get text from rogramms runn by subprocess.Popen immediatetly

2009-04-16 Thread Rüdiger Ranft
Diez B. Roggisch schrieb: Rüdiger Ranft schrieb: Hi all, I need to call some programms and catch their stdout and stderr streams. While the Popen class from subprocess handles the call, I get the results of the programm not until the programm finishes. Since the output of the programm is

Re: Question to python C API

2009-04-16 Thread Diez B. Roggisch
it is possible to write C and python code into the same file ? Not as such. And JNI is an atrocity, btw. But what you can do (if you have a pure C-API, no C++) is to completely ditch the C from the equation and go for ctypes. This allows you to easily wrap the C-functions

Re: Is there any way to find out the definition of a function in a file of C language?

2009-04-16 Thread Diez B. Roggisch
Jebel schrieb: Hi ,everyone. I have the name of a function of C language, and have the source file which the function is defined in. And I want to find out the type and name of the parameters. If I need to analyze the file by myself, or have some way to do it more easily? Google for ctypes

Re: Developing modules with ‘pkgutil’

2009-04-16 Thread Ben Finney
Peter Otten __pete...@web.de writes: Weird idea. Try putting the following in your __init__.py files: import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) __path__.reverse() import __init__ globals().update(vars(__init__)) __path__.reverse() That's rather astounding. It

Create standalone Windows program with simple graphics?

2009-04-16 Thread Poster28
Hi, I'd like to program and compile a simple graphics program (showing something like a chess board, some numbers and buttons, mouse support) and provide it as a standalone binary for Windows users. What is the easiest way to do that? Which libraries or compilers I should use? --

Re: What IDE support python 3.0.1 ?

2009-04-16 Thread Craig
Well i use netbean is alot better i think and it work with 2.6 and 3.0 --- On Thu, 4/16/09, mousemeat mousem...@gmail.com wrote: From: mousemeat mousem...@gmail.com Subject: Re: What IDE support python 3.0.1 ? To: python-list@python.org Date: Thursday, April 16, 2009, 4:41 AM Use eclipse with

Re: [Python-Dev] RELEASED Python 2.6.2

2009-04-16 Thread Ronald Oussoren
On 15 Apr, 2009, at 22:47, Russell E. Owen wrote: Thank you for 2.6.2. I see the Mac binary installer isn't out yet (at least it is not listed on the downloads page). Any chance that it will be compatible with 3rd party Tcl/Tk? The Mac installer is late because I missed the

Re: Python unit tests.

2009-04-16 Thread alessiogiovanni . baroni
On 15 Apr, 16:18, s...@pobox.com wrote:     how do I read the info athttp://coverage.livinglogic.de? For     example, inhttp://coverage.livinglogic.de/Objects/funcobject.c.html,     the count field, what it means? Most likely it's the number of times that line was executed.  Strong support

Re: get text from rogramms runn by subprocess.Popen immediatetly

2009-04-16 Thread Diez B. Roggisch
Rüdiger Ranft schrieb: Diez B. Roggisch schrieb: Rüdiger Ranft schrieb: Hi all, I need to call some programms and catch their stdout and stderr streams. While the Popen class from subprocess handles the call, I get the results of the programm not until the programm finishes. Since the output

Passing all extra commandline arguments to python program, Optparse raises exception

2009-04-16 Thread sapsi
Hello, Im using optparse and python 2.6 to parse some options, my commandline looks like prog [options] start|stop extra-args-i-will-pas-on The options are --b --c --d The extra options are varied are are passed onto another program e.g -- quiet --no-command , my program doesnt care what these

Python-URL! - weekly Python news and links (Apr 16)

2009-04-16 Thread Gabriel Genellina
QOTW: Yes, by Daddy telling him so. That's how nature does it, and how you should do it. Or do you think that because DNA-tests are available to us we should just put all kids into a big pool and make them find out who their parents are themselves, once they grew up? - Diez B. Roggisch, on data-

Data uploading to a ftp server

2009-04-16 Thread Ahmed, Shakir
I am getting following error while uploading data to a ftp server. Any help is highly appreciated. ftp.storbinary(stor erp.shp, ffile2,8192) File C:\Python24\lib\ftplib.py, line 419, in storbinary conn.sendall(buf) File string, line 1, in sendall error: (10054, 'Connection reset by

Re: Lambda alternative?

2009-04-16 Thread Duncan Booth
Hrvoje Niksic hnik...@xemacs.org wrote: Correct me if i am wrong, but i can pickle an object that contains a bound method (it's own bound method). No, you can't: import cPickle as p p.dumps([]) '(l.' p.dumps([].append) Traceback (most recent call last): File stdin, line 1, in

Re: Create standalone Windows program with simple graphics?

2009-04-16 Thread Chris Rebert
On Thu, Apr 16, 2009 at 6:12 AM, Poster28 usen...@anton.e4ward.com wrote: Hi, I'd like to program and compile a simple graphics program (showing something like a chess board, some numbers and buttons, mouse support) and provide it as a standalone binary for Windows users. What is the

Unpreempted behavior with sys.setcheckinterval

2009-04-16 Thread k3xji
Hi all, I want unpreempted behavior for some application and do some testing as below. Well the unpreemption behavior is working fine with sys.setcheckinterval(sys.maxint). However, when I set the interval to a lower value, the thread does not being preempted anymore, it runs until it is

Man Bites Python

2009-04-16 Thread Aahz
http://news.yahoo.com/s/nm/20090415/od_nm/us_python_odd_1/print -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ Why is this newsgroup different from all other newsgroups? -- http://mail.python.org/mailman/listinfo/python-list

Re: Man Bites Python

2009-04-16 Thread Roy Hyunjin Han
Hahaha! On Thu, Apr 16, 2009 at 10:27 AM, Aahz a...@pythoncraft.com wrote: http://news.yahoo.com/s/nm/20090415/od_nm/us_python_odd_1/print -- Aahz (a...@pythoncraft.com)           *         http://www.pythoncraft.com/ Why is this newsgroup different from all other newsgroups? --

Re: any(), all() and empty iterable

2009-04-16 Thread Dale Roberts
On Apr 14, 8:33 am, Tim Chase python.l...@tim.thechases.com wrote: ... I still prefer Return False if any element of the iterable is not true or Return False if any element in the iterable is false because that describes exactly what the algorithm does. I agree that the original doc comment

Re: Create standalone Windows program with simple graphics?

2009-04-16 Thread Dave Angel
Poster28 wrote: Hi, I'd like to program and compile a simple graphics program (showing something like a chess board, some numbers and buttons, mouse support) and provide it as a standalone binary for Windows users. What is the easiest way to do that? Which libraries or compilers I should use?

Re: binary file compare...

2009-04-16 Thread Grant Edwards
On 2009-04-16, Adam Olsen rha...@gmail.com wrote: The chance of *accidentally* producing a collision, although technically possible, is so extraordinarily rare that it's completely overshadowed by the risk of a hardware or software failure producing an incorrect result. Not when you're

Re: Passing all extra commandline arguments to python program, Optparse raises exception

2009-04-16 Thread Dave Angel
sapsi wrote: Hello, Im using optparse and python 2.6 to parse some options, my commandline looks like prog [options] start|stop extra-args-i-will-pas-on The options are --b --c --d The extra options are varied are are passed onto another program e.g -- quiet --no-command , my program doesnt

How to access C structures

2009-04-16 Thread Chris Helck
I have a couple dozen C structures that define binary file records. I need to read the file and access the records. I need to do this very efficiantly. I am aware of the Python struct class, but the C structures contain arrays of nested structures and I'm not sure if Python struct can handle it.

Can I use setup.py to ship and install only .pyc files?

2009-04-16 Thread Mike Kent
I'd like to ship only the .pyc files for a module. I was hoping the standard distutils setup.py could handle this, but so far, I've not figured out how. After a bit of work, I discovered that if I create a MANIFEST.in file, and put 'include mymodule/*.pyc' and 'exclude mymodule/*.py' in it, then

setuptools catch 22

2009-04-16 Thread Mac
We've got ActiveState Python 2.6 installed on a Windows XP box, and I pulled down the latest archgenxml package (2.2) in order to get it running under this installation of Python. I unpacked the tarball for the package and tried running `python setup.py build' but got an ImportError exception: no

Reading an exact number of characters from input

2009-04-16 Thread Paddy O'Loughlin
Hi, How would I use python to simply read a specific number of characters from standard input? raw_input() only returns when the user inputs a new line (or some other special character). I tried import sys sys.stdin.read(15) and that *returns* up to 15 characters, but it keeps accepting input

Re: Create standalone Windows program with simple graphics?

2009-04-16 Thread Poster28
What is the easiest way to do that? Which libraries or compilers I should use? http://www.py2exe.org/ Will it work with any graphics library? -- http://mail.python.org/mailman/listinfo/python-list

Re: Question to python C API

2009-04-16 Thread Stefan Behnel
Andreas Otto wrote: I want to make a language binding for an existing C library http://libmsgque.sourceforge.net is this possible ? Quoting the third paragraph on Cython's homepage (i.e. the link I posted): This makes Cython the ideal language for wrapping external C

Re: setuptools catch 22

2009-04-16 Thread Kay Schluehr
On 16 Apr., 17:39, Mac bob.u...@gmail.com wrote: We've got ActiveState Python 2.6 installed on a Windows XP box, and I pulled down the latest archgenxml package (2.2) in order to get it running under this installation of Python.  I unpacked the tarball for the package and tried running `python

Help improve program for parsing simple rules

2009-04-16 Thread pruebauno
Another interesting task for those that are looking for some interesting problem: I inherited some rule system that checks for programmers program outputs that to be ported: given some simple rules and the values it has to determine if the program is still working correctly and give the details of

Re: What IDE support python 3.0.1 ?

2009-04-16 Thread Scott David Daniels
Aahz wrote: In article mailman.3975.1239852366.11746.python-l...@python.org, Brendon Wickham brendon.wick...@gmail.com wrote: I agree, no IDE needed. Just don't use Notepad! I'm on Mac, so spoiled for choice of text editors, but I'm sure there's one or 2 good uns if you're on Windows. Vim

Re: Man Bites Python

2009-04-16 Thread alex goretoy
+1 Aahz -Alex Goretoy http://www.goretoy.com Mitch Hedberghttp://www.brainyquote.com/quotes/authors/m/mitch_hedberg.html - I drank some boiling water because I wanted to whistle. On Thu, Apr 16, 2009 at 2:32 PM, Roy Hyunjin Han starsareblueandfara...@gmail.com wrote: Hahaha! On Thu, Apr

Re: compiler package vs parser

2009-04-16 Thread Aahz
In article mailman.3979.1239874929.11746.python-l...@python.org, Robin Becker ro...@reportlab.com wrote: Is the compiler package actually supposed to be equivalent to the parser module? Before I poke my nose into this, what versions of Python have you tried? -- Aahz (a...@pythoncraft.com)

Re: setuptools catch 22

2009-04-16 Thread Diez B. Roggisch
Mac schrieb: We've got ActiveState Python 2.6 installed on a Windows XP box, and I pulled down the latest archgenxml package (2.2) in order to get it running under this installation of Python. I unpacked the tarball for the package and tried running `python setup.py build' but got an

Re: What IDE support python 3.0.1 ?

2009-04-16 Thread Aahz
In article hvudnr3xsqnmynrunz2dnuvz_rkdn...@pdx.net, Scott David Daniels scott.dani...@acm.org wrote: Aahz wrote: In article mailman.3975.1239852366.11746.python-l...@python.org, Brendon Wickham brendon.wick...@gmail.com wrote: I agree, no IDE needed. Just don't use Notepad! I'm on Mac, so

Re: Reading an exact number of characters from input

2009-04-16 Thread Diez B. Roggisch
Paddy O'Loughlin schrieb: Hi, How would I use python to simply read a specific number of characters from standard input? raw_input() only returns when the user inputs a new line (or some other special character). I tried import sys sys.stdin.read(15) and that *returns* up to 15 characters,

Re: Imports in python are static, any solution?

2009-04-16 Thread Ravi
On Apr 14, 1:23 am, norseman norse...@hughes.net wrote: AJ Mayorga wrote: For something like this I generally create a superclass to hold configuration variables that will change overtime, doing that will save you from insanity. Class configVar:    #set initial values    Def

Re: Reading an exact number of characters from input

2009-04-16 Thread Scott David Daniels
Paddy O'Loughlin wrote: Hi, How would I use python to simply read a specific number of characters from standard input? raw_input() only returns when the user inputs a new line (or some other special character). I tried import sys sys.stdin.read(15) and that *returns* up to 15 characters, but

Getting Newsgroup Headers

2009-04-16 Thread aslkoi fdsda
I would like to read just the headers out of a newsgroup. Being a Python newbie, I was wondering if this is possible and how difficult it would be for a novice Python programmer. Thanks for any reply! -- http://mail.python.org/mailman/listinfo/python-list

Choose: class with static methods or module with functions

2009-04-16 Thread Ravi
I have to create a few helper/utility application-wide functions. There are two options: 1. Create a Utility class and all functions as static method of that class. 2. Create a module, utility.py and member functions. Which is a better approach. My personal view is that I should create a

Re: Question to python C API

2009-04-16 Thread Stefan Behnel
Andreas Otto wrote: the problem with such kind of framework is usually that you start with the easy stuff and than (after a couple of days/weeks) you come to the difficult stuff and you have to figure out that this kind of problem does not fit into the tool. That is a very common

Re: Choose: class with static methods or module with functions

2009-04-16 Thread bearophileHUGS
Ravi: Which is a better approach. My personal view is that I should create a module with functions. When in doubt, use the simplest solution that works well enough. In this case, module functions are simple and probably enough. But there can be a situation where you want to keep functions even

Queue() question. This post is pretty long.

2009-04-16 Thread grocery_stocker
I don't get how item = self.__queue.get() gets advanced to if item is None: in the following code. import time from threading import Thread import Queue WORKER = 2 class Worker(Thread): ... def __init__(self, queue): ... Thread.__init__(self) ... self.__queue =

Re: binary file compare...

2009-04-16 Thread SpreadTooThin
On Apr 16, 3:16 am, Nigel Rantor wig...@wiggly.org wrote: Adam Olsen wrote: On Apr 15, 12:56 pm, Nigel Rantor wig...@wiggly.org wrote: Adam Olsen wrote: The chance of *accidentally* producing a collision, although technically possible, is so extraordinarily rare that it's completely

Domain Driven Design and Python

2009-04-16 Thread José María
Hi, I've been searching for information about the application of DDD principles in Python and I did'nt found anything! Is DDD obvious in Python or is DDD inherent to static languages like Java or C#? Cheers. -- http://mail.python.org/mailman/listinfo/python-list

Re: any(), all() and empty iterable

2009-04-16 Thread Raymond Hettinger
The doc should speak to the intended audience: programmers, who like to make sure all bases and cases are covered. FWIW, I wrote the docs. The pure python forms were put in as an integral part of the documentation. The first sentence of prose was not meant to stand alone. It is a lead-in to

pyqt4: setText() inside a function

2009-04-16 Thread l . freschi
I'm developing a PyQt4 application. I have created a button: ... self.start_button=QtGui.QPushButton(start simulation, self) ... that is connected to a function: ... self.connect(self.start_button, QtCore.SIGNAL('clicked()'), self.simulate) ... This is the function: ... def simulate(self):

Re: get text from rogramms runn by subprocess.Popen immediatetly

2009-04-16 Thread norseman
Rüdiger Ranft wrote: Hi all, I need to call some programms and catch their stdout and stderr streams. While the Popen class from subprocess handles the call, I get the results of the programm not until the programm finishes. Since the output of the programm is used to generate a progress

Re: pyqt4: setText() inside a function

2009-04-16 Thread Diez B. Roggisch
l.fres...@gmail.com schrieb: I'm developing a PyQt4 application. I have created a button: ... self.start_button=QtGui.QPushButton(start simulation, self) ... that is connected to a function: ... self.connect(self.start_button, QtCore.SIGNAL('clicked()'), self.simulate) ... This is the

Re: WHIFF - was: Re: Using Python after a few years of Ruby

2009-04-16 Thread Aaron Watters
On Apr 15, 4:35 pm, Gerhard Häring g...@ghaering.de wrote: WTF?! This is weird stuff! Why the hell would I use this instead of a Python web framework like Django/Pylons/etc. Ok folks. I've added a page: Whiff is cool because: How do you make a page like this using another package?

Re: any(), all() and empty iterable

2009-04-16 Thread Tim Chase
Raymond Hettinger wrote: I will not change the sentence to return false if any element of the iterable is false. The negations make the sentence hard to parse mentally Just as a ribbing, that return X if any element of the iterable is X is of the same form as the original. The negation is

Re: Create standalone Windows program with simple graphics?

2009-04-16 Thread norseman
Poster28 wrote: Hi, I'd like to program and compile a simple graphics program (showing something like a chess board, some numbers and buttons, mouse support) and provide it as a standalone binary for Windows users. What is the easiest way to do that? Which libraries or compilers I should use?

Re: any(), all() and empty iterable

2009-04-16 Thread Paul Rudin
Tim Chase python.l...@tim.thechases.com writes: Changing the implementation of all() would break wy too much stuff... Not to mention it clearly works correctly as is. *If* there is an issue it is a documentation one... not an implementation one. --

[OT] large db question about no joins

2009-04-16 Thread Daniel Fetchinson
[off but interesting topic] Hi folks, I've come across many times the claim that 'joins are bad' for large databases because they don't scale. Okay, makes sense, we agree. But what I don't get, although I watched a couple of online videos on this topic (one by the creator of flickr who gave a

Re: any(), all() and empty iterable

2009-04-16 Thread Dale Roberts
On Apr 16, 2:27 pm, Tim Chase python.l...@tim.thechases.com wrote: Raymond Hettinger wrote: I will not change the sentence to return false if any element of the iterable is false.  The negations make the sentence hard to parse mentally Just as a ribbing, that return X if any element of

Re: Queue() question. This post is pretty long.

2009-04-16 Thread Piet van Oostrum
grocery_stocker cdal...@gmail.com (g) wrote: g [cdal...@localhost ~]$ python g Python 2.4.3 (#1, Oct 1 2006, 18:00:19) g [GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2 g Type help, copyright, credits or license for more information. import Queue queue = Queue.Queue() while 1: g ...

Re: Choose: class with static methods or module with functions

2009-04-16 Thread Chris Rebert
On Thu, Apr 16, 2009 at 9:55 AM, bearophileh...@lycos.com wrote: Ravi: Which is a better approach. My personal view is that I should create a module with functions. When in doubt, use the simplest solution that works well enough. In this case, module functions are simple and probably

Re: Domain Driven Design and Python

2009-04-16 Thread Chris Rebert
On Thu, Apr 16, 2009 at 10:44 AM, José María josemariar...@gmail.com wrote: Hi, I've been searching for information about the application of DDD principles in Python and I did'nt found anything! Is DDD obvious in Python or is DDD inherent to static languages like Java or C#? Reading the

How do I change the behavior of the 'python-docs' action in IDLE?

2009-04-16 Thread samwyse
In the Windows version of Python 2.5, pressing F1 brought up the python.chm file. I've just installed 2.6, and the same action opens http://www.python.org/doc/current/. I'd prefer the former behavior. I know how to change the key bindings in config-keys.def, but I think I want to change the

Re: binary file compare...

2009-04-16 Thread Adam Olsen
On Apr 16, 8:59 am, Grant Edwards inva...@invalid wrote: On 2009-04-16, Adam Olsen rha...@gmail.com wrote: I'm afraid you will need to back up your claims with real files. Although MD5 is a smaller, older hash (128 bits, so you only need 2**64 files to find collisions), You don't need

Re: win32 wins settings

2009-04-16 Thread Tim Golden
Toff wrote: hello I don't understand why this doesn't woks. def setwins(self): from win32com.client import GetObject objWMIService = GetObject(winmgmts: {impersonationLevel=impersonate}!.\\root\\cimv2) colNicConfigs = objWMIService.ExecQuery (SELECT * FROM

Re: Domain Driven Design and Python

2009-04-16 Thread Stef Mientki
José María wrote: Hi, I've been searching for information about the application of DDD principles in Python and I did'nt found anything! Is DDD obvious in Python or is DDD inherent to static languages like Java or C#? Cheers. -- http://mail.python.org/mailman/listinfo/python-list I'm not

Re: Getting Newsgroup Headers

2009-04-16 Thread Chris Rebert
On Thu, Apr 16, 2009 at 9:25 AM, aslkoi fdsda pythonz...@gmail.com wrote: I would like to read just the headers out of a newsgroup. Being a Python newbie, I was wondering if this is possible and how difficult it would be for a novice Python programmer. Thanks for any reply! See the `nntplib`

Re: any(), all() and empty iterable

2009-04-16 Thread John Posner
Tim Chase wrote: I will probably leave the lead-in sentence as-is but may add another sentence specifically covering the case for an empty iterable. as one of the instigators in this thread, I'm +1 on this solution. Thanks for weighing in, Raymond. As long as people are getting in their last

  1   2   3   >