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 lab

Re: HTML Generation

2009-04-16 Thread Nick Craig-Wood
J Kenneth King wrote: > Stefan Behnel 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 given -- > only meant as inspi

Re: Best way to extract from regex in if statement

2009-04-16 Thread Nick Craig-Wood
Paul McGuire wrote: > On Apr 3, 9:26 pm, Paul Rubin wrote: > > bwgoudey writes: > > > elif re.match("^DATASET:\s*(.+) ", line): > > >         m=re.match("^DATASET:\s*(.+) ", line) > > >         print m.group(1)) > > > > Sometimes I like to make a special class that

Re: interacting with an updatedb generated data file within python

2009-04-16 Thread Nick Craig-Wood
birdsong 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 storing it, but I see no

Re: Question to python C API

2009-04-16 Thread Ben Kaplan
On Apr 16, 2009, at 1:53 AM, Andreas Otto 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. Look at www.swig.org if

Re: PEP 382: Namespace Packages

2009-04-16 Thread syt
On Apr 14, 6:27 pm, "P.J. Eby" 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 of those packages

Re: binary file compare...

2009-04-16 Thread Adam Olsen
On Apr 15, 12:56 pm, Nigel Rantor 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 result.

Re: ANN: PyGUI 2.0.1

2009-04-16 Thread fyaqq
On 4月16日, 上午3时05分, Suraj Barkale wrote: > Greg Ewing 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 Windows > XP > SP3. Followi

Re: Lambda alternative?

2009-04-16 Thread Duncan Booth
Paul Rubin wrote: > Duncan Booth 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 > unpickling) i

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 names

Re: Lambda alternative?

2009-04-16 Thread mousemeat
On 16 Apr, 09:39, Duncan Booth wrote: > Paul Rubin wrote: > > Duncan Booth 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

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.

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

2009-04-16 Thread Piet van Oostrum
> John Machin (JM) wrote: >JM> On Apr 16, 8:14 am, Chris Rebert 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 >JM> dif

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__': func(dict(i=1,j=33))

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 wrote: > Adam Olsen wrote: > > On Apr 15, 12:56 pm, Nigel Rantor 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

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

2009-04-16 Thread Arnaud Delobelle
Piet van Oostrum writes: >> John Machin (JM) wrote: > >>JM> On Apr 16, 8:14 am, Chris Rebert 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 interpret

Re: binary file compare...

2009-04-16 Thread Nigel Rantor
Adam Olsen wrote: On Apr 16, 3:16 am, Nigel Rantor wrote: Adam Olsen wrote: On Apr 15, 12:56 pm, Nigel Rantor 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

Re: binary file compare...

2009-04-16 Thread Nigel Rantor
Adam Olsen wrote: On Apr 15, 12:56 pm, Nigel Rantor 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 resu

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 pyt

Re: Lambda alternative?

2009-04-16 Thread Hrvoje Niksic
mousemeat 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 modules, then the > in

Re: Interrupt Python C API

2009-04-16 Thread googler . 1 . webmaster
On 16 Apr., 11:08, Piet van Oostrum 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 W

Re: Lambda alternative?

2009-04-16 Thread Aaron Brady
On Apr 16, 5:25 am, mousemeat wrote: > On 16 Apr, 10:21, Hrvoje Niksic wrote: > > > > > mousemeat 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

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 wrote: > mousemeat 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 incompa

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? -- http://mail.python.org/mailman/listinf

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>, > >   wrote: > > >Steven, I'd appreciate if you could refrain from criticizing so > >bluntly so many points.  I'd be great if you trusted me more for > >kn

Re: Lambda alternative?

2009-04-16 Thread Hrvoje Niksic
mousemeat 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 "", line 1, in TypeError: expected stri

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 indic

Re: Equivalent to C bitmasks and enumerations

2009-04-16 Thread Dave Angel
John Machin wrote: On Apr 16, 10:13 am, Dave Angel 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 def seal():

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 Data: Wed, 15 Apr 2009 22:25:36 -0300 Do: Deep_Feelings Do: Deep_Feelings Kopia: python-list@python.org I want to start learning python and not wanna was

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 acc

Re: Python interpreters in threads crash the application

2009-04-16 Thread Aahz
In article <74bec1d9-2109-4b9e-8e4d-541894a4d...@f41g2000pra.googlegroups.com>, grbgooglefan 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 never finishes

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 > ou

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 : http://www.rastersoft.com/programas/devede.ht

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 pr

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 i

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 and

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 astoundin

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? -- http://mail.pyth

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 wrote: From: mousemeat 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 the pydev module.  I use python(x,y) whi

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 pre-announceme

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

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 o

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 a

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 "", line 1, in sendall error: (10054, 'Connection reset by p

Re: Lambda alternative?

2009-04-16 Thread Duncan Booth
Hrvoje Niksic 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 "", line 1, in > Ty

Re: Create standalone Windows program with simple graphics?

2009-04-16 Thread Chris Rebert
On Thu, Apr 16, 2009 at 6:12 AM, 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?

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 finished.

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 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? > -- > http://mail.python.org

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

2009-04-16 Thread Dale Roberts
On Apr 14, 8:33 am, Tim Chase 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 is not helpful as it st

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 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

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 ca

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. I

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 i

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 li

Re: setuptools catch 22

2009-04-16 Thread Kay Schluehr
On 16 Apr., 17:39, Mac 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 setup.py build

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 , Brendon Wickham 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 and emacs, of course. ;-) No, that is only one great editor and one abominati

Re: Man Bites Python

2009-04-16 Thread alex goretoy
+1 Aahz -Alex Goretoy http://www.goretoy.com Mitch Hedberg - "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

Re: compiler package vs parser

2009-04-16 Thread Aahz
In article , Robin Becker 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) <*> http://www.pythoncraft.com/ "If you think it's exp

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 ImportError

Re: What IDE support python 3.0.1 ?

2009-04-16 Thread Aahz
In article , Scott David Daniels wrote: >Aahz wrote: >> In article , >> Brendon Wickham 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 and emacs, of

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, bu

Re: Imports in python are static, any solution?

2009-04-16 Thread Ravi
On Apr 14, 1:23 am, norseman 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 __init__(sel

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 module

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 comm

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 eve

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) ...

Re: binary file compare...

2009-04-16 Thread SpreadTooThin
On Apr 16, 3:16 am, Nigel Rantor wrote: > Adam Olsen wrote: > > On Apr 15, 12:56 pm, Nigel Rantor 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

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 indicat

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 functi

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 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?" http://aaron.o

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

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 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. -- http://mail.python.org/mailman/listinfo/python-list

[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 talk

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

2009-04-16 Thread Dale Roberts
On Apr 16, 2:27 pm, Tim Chase 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 the iterable > is X"

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

2009-04-16 Thread Piet van Oostrum
> grocery_stocker (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() > >>

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, 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 enough. > > But there c

Re: Domain Driven Design and Python

2009-04-16 Thread Chris Rebert
On Thu, Apr 16, 2009 at 10:44 AM, 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#? Reading the Wikipedia article

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 actio

Re: binary file compare...

2009-04-16 Thread Adam Olsen
On Apr 16, 8:59 am, Grant Edwards wrote: > On 2009-04-16, Adam Olsen 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 quite that many to have a

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 Win32_N

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 a

Re: Getting Newsgroup Headers

2009-04-16 Thread Chris Rebert
On Thu, Apr 16, 2009 at 9:25 AM, aslkoi fdsda 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` [http://docs.pyth

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

Re: large db question about no joins

2009-04-16 Thread Aaron Brady
On Apr 16, 1:45 pm, Daniel Fetchinson wrote: > [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

  1   2   >