newbie SWIG typemap question

2006-02-12 Thread Syrinx
Hi everyone. I'm new to SWIG, and I'm trying to wrap a C library for Python. I have a function that is declared similarly to this: double *foo(int x); The function returns a pointer to an array of 7 double values. I want to return a 7-tuple to Python. I've been trying variations of the follow

Wanted Python and C developer Urgently

2006-02-12 Thread Rozario, Sophia_Diana
Hi, I am posting a couple of requirements in my organization. Any one interested can reply me directly. Maestro Software Developer We are seeking experienced software professionals to design and develop new components as well as to enhance and maintain Maestro, a best-of-breed computational chem

Re: how do you pronounce 'tuple'?

2006-02-12 Thread [EMAIL PROTECTED]
Grant Edwards wrote: > On 2006-02-13, John Salerno <[EMAIL PROTECTED]> wrote: > > > I know it comes from the suffix -tuple, which makes me think > > it's pronounced as 'toople', but I've seen (at m-w.com) that > > the first pronunciation option is 'tuhple', so I wasn't sure. > > Maybe it's both, bu

Re: ordered sets operations on lists..

2006-02-12 Thread Kay Schluehr
Bengt Richter wrote: > Perhaps newbies should be advised that > > [x for x in l1 if x in set(l2)] But the resulting list is a representative of bag not a set ( contains multiple occurrences of elements ): >>> [x for x in [3, 3] if s in Set([3])] [3,3] Same with Raymonds solution: >>> filt

Re: Slightly OT: Ranking noise

2006-02-12 Thread Fredrik Lundh
Kay Schluehr wrote: > For those people who use google groups to access comp.lang.python may > enjoy now looking at contentess shiny yellow stars - shining brighter > than anything else on the site. The only pattern I've found are one or > two shiny yellow stars for many newbie postings. According

Re: ordered sets operations on lists..

2006-02-12 Thread Brett Cannon
On 2/12/06, Felipe Almeida Lessa <[EMAIL PROTECTED]> wrote: > Em Dom, 2006-02-12 às 23:15 -0500, Steve Holden escreveu: > > Given that Python 2.4 doesn't even perform simple constant folding for > > arithmetic expressions > > [snip] > > May I ask why doesn't it perform such optimization? Is there a

Re: how do you pronounce 'tuple'?

2006-02-12 Thread Erik Max Francis
John Salerno wrote: > Yes, silly question, but it keeps me up at night. :) > > I know it comes from the suffix -tuple, which makes me think it's > pronounced as 'toople', but I've seen (at m-w.com) that the first > pronunciation option is 'tuhple', so I wasn't sure. Maybe it's both, but > whi

Re: Is python very slow compared to C

2006-02-12 Thread bonono
PA wrote: > On Feb 13, 2006, at 06:44, [EMAIL PROTECTED] wrote: > > > And if we use market penetration as measure, Perl seems to be easier > > for people ? > > Perl: Shell scripts/awk/sed are not enough like programming languages. > > Python: Perl is a kludge. > > "What Languages Fix" > http://www

Re: Is python very slow compared to C

2006-02-12 Thread PA
On Feb 13, 2006, at 06:44, [EMAIL PROTECTED] wrote: > And if we use market penetration as measure, Perl seems to be easier > for people ? Perl: Shell scripts/awk/sed are not enough like programming languages. Python: Perl is a kludge. "What Languages Fix" http://www.paulgraham.com/fix.html Ch

Slightly OT: Ranking noise

2006-02-12 Thread Kay Schluehr
For those people who use google groups to access comp.lang.python may enjoy now looking at contentess shiny yellow stars - shining brighter than anything else on the site. The only pattern I've found are one or two shiny yellow stars for many newbie postings. According to the staring semantics the

Re: Newbie

2006-02-12 Thread mcbooczech
For me (I am newbie as well) was following link very useful: http://benyoonline.com/pqr/PQR2.4.html Good luck with Python Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list

Python 3000 deat !? Is true division ever coming ?

2006-02-12 Thread seb . haase
Hi, Is it true that that "Python 3000" is dead ? Honestly I think that e.g. changing 5/2 to be 2.5 (instead of 2) would just break to much code :-( On the otherhand I'm using Python as "Matlab replacement" and would generally like 5/2 ==2.5 So, I was contemplating to default all my modules/script

how to create a movie ?

2006-02-12 Thread seb . haase
Hi, I have a series of images (either from numarray or from PIL) After googling if read something about pyMedia... Can I create an AVI movie from my images with that ? How about quicktime ? Thanks, Sebastian Haase -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python very slow compared to C

2006-02-12 Thread bonono
Steven D'Aprano wrote: > [EMAIL PROTECTED] wrote: > > > I can speak the same about Python if I view it from a prototype based > > perspective, where one get them for free in Lua but need to implement > > them in Python. > > Sure. And if you need prototypes, then all else being > equal that would b

Re: Is python very slow compared to C

2006-02-12 Thread Steve Holden
Steven D'Aprano wrote: > [EMAIL PROTECTED] wrote: > > >>I can speak the same about Python if I view it from a prototype based >>perspective, where one get them for free in Lua but need to implement >>them in Python. > > > Sure. And if you need prototypes, then all else being > equal that would

Re: Is python very slow compared to C

2006-02-12 Thread Steven D'Aprano
[EMAIL PROTECTED] wrote: > I can speak the same about Python if I view it from a prototype based > perspective, where one get them for free in Lua but need to implement > them in Python. Sure. And if you need prototypes, then all else being equal that would be a disadvantage of Python compared

Re: ordered sets operations on lists..

2006-02-12 Thread Steve Holden
Felipe Almeida Lessa wrote: > Em Dom, 2006-02-12 às 23:51 -0500, Steve Holden escreveu: > >>The basic answer is that so far no developer has felt it worthwhile to >>expend time on adding these optimizations. > > > I always thought these small optimizations could lead Python to be > faster overa

RE: ordered sets operations on lists..

2006-02-12 Thread Delaney, Timothy (Tim)
Delaney, Timothy (Tim) wrote: > Adding such optimisations to Python may improve it's benchmark scores, Blegh! Time to give myself a good kicking! Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: ordered sets operations on lists..

2006-02-12 Thread Felipe Almeida Lessa
Em Dom, 2006-02-12 às 23:51 -0500, Steve Holden escreveu: > The basic answer is that so far no developer has felt it worthwhile to > expend time on adding these optimizations. I always thought these small optimizations could lead Python to be faster overall. I remember about this every time I see

RE: ordered sets operations on lists..

2006-02-12 Thread Delaney, Timothy (Tim)
Steve Holden wrote: > The basic answer is that so far no developer has felt it worthwhile to > expend time on adding these optimizations. Mainly because it's rare to find such constructs in anything except contrived examples ... Nearly every time you use a literal, it's being added to (subtracted

Re: Newbie

2006-02-12 Thread bonono
LittlePython wrote: > I am very new to python. I have been studying it for only a month or so. I > have been using vbscript for about 2-3 yrs and only recently been using it > rather heavily the past 9 months or so. I am new very new to oop. My main > use will be administrative scripting into the

Re: how do you pronounce 'tuple'?

2006-02-12 Thread Markus Wankus
John Salerno wrote: > Yes, silly question, but it keeps me up at night. :) > > I know it comes from the suffix -tuple, which makes me think it's > pronounced as 'toople', but I've seen (at m-w.com) that the first > pronunciation option is 'tuhple', so I wasn't sure. Maybe it's both, but > whic

Re: ordered sets operations on lists..

2006-02-12 Thread Steve Holden
Felipe Almeida Lessa wrote: > Em Dom, 2006-02-12 às 23:15 -0500, Steve Holden escreveu: > >>Given that Python 2.4 doesn't even perform simple constant folding for >>arithmetic expressions >>[snip] > > > May I ask why doesn't it perform such optimization? Is there any special > difficulties in d

Re: ordered sets operations on lists..

2006-02-12 Thread Felipe Almeida Lessa
Em Dom, 2006-02-12 às 23:15 -0500, Steve Holden escreveu: > Given that Python 2.4 doesn't even perform simple constant folding for > arithmetic expressions > [snip] May I ask why doesn't it perform such optimization? Is there any special difficulties in doing so with the Python compiler? Also, I

Re: how do you pronounce 'tuple'?

2006-02-12 Thread Grant Edwards
On 2006-02-13, John Salerno <[EMAIL PROTECTED]> wrote: > I know it comes from the suffix -tuple, which makes me think > it's pronounced as 'toople', but I've seen (at m-w.com) that > the first pronunciation option is 'tuhple', so I wasn't sure. > Maybe it's both, but which is most prevalent? In m

Re: how do you pronounce 'tuple'?

2006-02-12 Thread Steve Holden
John Salerno wrote: > Yes, silly question, but it keeps me up at night. :) > Silly you! > I know it comes from the suffix -tuple, which makes me think it's > pronounced as 'toople', but I've seen (at m-w.com) that the first > pronunciation option is 'tuhple', so I wasn't sure. Maybe it's both,

Re: ordered sets operations on lists..

2006-02-12 Thread Steve Holden
Alex Martelli wrote: > Bengt Richter <[EMAIL PROTECTED]> wrote: >... > >>>Personally, I'd always use (depending on guesses regarding lengths of >>>lists) [x for x in l1 if x in l2] or the setified equivalent, of course. >>> >> >>Perhaps newbies should be advised that >> >>[x for x in l1 if

Re: Newbie

2006-02-12 Thread Steve Holden
LittlePython wrote: > I am very new to python. I have been studying it for only a month or so. I > have been using vbscript for about 2-3 yrs and only recently been using it > rather heavily the past 9 months or so. I am new very new to oop. My main > use will be administrative scripting into the w

Re: Jython socket typecasting problems

2006-02-12 Thread Steve Holden
Diez B. Roggisch wrote: >>This is the code section of my server class (I cut this from a Python >>example): >>def establishConnection(self): >>self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >>self.socket.connect((self.host, self.port)) >>Do I have to use explici

how do you pronounce 'tuple'?

2006-02-12 Thread John Salerno
Yes, silly question, but it keeps me up at night. :) I know it comes from the suffix -tuple, which makes me think it's pronounced as 'toople', but I've seen (at m-w.com) that the first pronunciation option is 'tuhple', so I wasn't sure. Maybe it's both, but which is most prevalent? Thanks! No

Re: Downloading Large Files -- Feedback?

2006-02-12 Thread Alex Martelli
mwt <[EMAIL PROTECTED]> wrote: ... > import urllib > > def download_file(filename, URL): > f = urllib.urlretrieve(URL, filename, reporthook=my_report_hook) If you wanted to DO anything with the results, you'd probably want to assign to f, m = ... not just f. This way, f is the filenam

Re: Downloading Large Files -- Feedback?

2006-02-12 Thread mwt
So, I just put this little chunk to the test, which does give you feedback about what's going on with a file download. Interesting that with urlretrieve, you don't do all the file opening and closing stuff. Works fine: -- import urllib def download_file(filename, URL): f = ur

Re: Downloading Large Files -- Feedback?

2006-02-12 Thread Alex Martelli
mwt <[EMAIL PROTECTED]> wrote: > Thanks for the explanation. That is exactly what I'm looking for. In a > way, it's kind of neat that urlopen just *does* it, no questions asked, > but I'd like to just know the basics, which is what it sounds like > urlretrieve covers. Excellent. Now, let's see wha

Re: Questions for BitTorrent's Author, Bram Cohen

2006-02-12 Thread Alex Martelli
Steve Holden <[EMAIL PROTECTED]> wrote: > Bram Cohen will be a keynoter at this year's PyCon, and has asked that > the presentation be in the form of an interview. > > I'd like the questions to be representative of as broad a cross-section > of the Python community as possible. If you have a ques

Re: Is Forth for real?

2006-02-12 Thread Elizabeth D Rather
"Cameron Laird" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In article <[EMAIL PROTECTED]>, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > . > . > . >>on the web for each language. By comparison, even Forth gives 13 million >>plus hits, and who uses Forth? > . > . > . > The prog

Re: Downloading Large Files -- Feedback?

2006-02-12 Thread mwt
>It isn't written in C, but get your hands on wget. It >is probably already on your Linux distro, but if not, >check it out here: >http://www.gnu.org/software/wget/wget.html Thanks. I'm checking it out. -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions for BitTorrent's Author, Bram Cohen

2006-02-12 Thread Felipe Almeida Lessa
Em Dom, 2006-02-12 às 20:10 -0500, Steve Holden escreveu: > I'd like the questions to be representative of as broad a cross-section > of the Python community as possible. If you have a question you'd like > to hear Bram answer please let me know and I'll try to include them. Something I think lo

Re: Python equivilant to msgbox()

2006-02-12 Thread André
Kent Johnson wrote: > LittlePython wrote: > > Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I > > would like to call this instead of print (to the screen) . I would like > > to write a simple script that is not an event drive gui but calls input > > boxes, message boxes, or m

Re: Is python very slow compared to C

2006-02-12 Thread bonono
Steven D'Aprano wrote: > > Programming in Lua > > Object-Oriented Programming > > http://www.lua.org/pil/16.html > > Did you actually bother to read the page you linked to? It describes how > you can emulate object-like behaviour for Lua tables. The following page > is even more explicit: "Lua doe

Re: Downloading Large Files -- Feedback?

2006-02-12 Thread mwt
Thanks for the explanation. That is exactly what I'm looking for. In a way, it's kind of neat that urlopen just *does* it, no questions asked, but I'd like to just know the basics, which is what it sounds like urlretrieve covers. Excellent. Now, let's see what I can whip up with that. -- just bou

Re: Downloading Large Files -- Feedback?

2006-02-12 Thread Steven D'Aprano
mwt wrote: > Pardon my ignorance here, but could you give me an example of what > would constitute file that is unreasonably or dangerously large? I'm > running python on a ubuntu box with about a gig of ram. 1GB of RAM plus (say) 2GB of virtual memory = 3GB in total. Your OS and other running p

Questions for BitTorrent's Author, Bram Cohen

2006-02-12 Thread Steve Holden
Hi: Bram Cohen will be a keynoter at this year's PyCon, and has asked that the presentation be in the form of an interview. I'd like the questions to be representative of as broad a cross-section of the Python community as possible. If you have a question you'd like to hear Bram answer please

Re: Python equivilant to msgbox()

2006-02-12 Thread LittlePython
That is exactly what I was look for .. thx "Kent Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > LittlePython wrote: > > Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I > > would like to call this instead of print (to the screen) . I would like > > to

Re: Python equivilant to msgbox()

2006-02-12 Thread Andre Burgaud
Hi,   If you target Windows, you may try ctypes http://starship.python.net/crew/theller/ctypes/:   >>> from ctypes import *>>> windll.user32.MessageBoxA(None, "MessageBox Text", "MessageBox Caption", 0)1>>>     or win32api http://starship.python.net/crew/mhammond/win32/: >>> import win32api>>> win3

Re: Python equivilant to msgbox()

2006-02-12 Thread Kent Johnson
LittlePython wrote: > Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I > would like to call this instead of print (to the screen) . I would like > to write a simple script that is not an event drive gui but calls input > boxes, message boxes, or maybe even a file open brows

Python equivilant to msgbox()

2006-02-12 Thread LittlePython
Is there an equivalent to a msgbox() or wscript.echo (via wcsript) . I would like to call this instead of print (to the screen) . I would like to write a simple script that is not an event drive gui but calls input boxes, message boxes, or maybe even a file open browser box as well? -- htt

Re: Yet another GUI toolkit question...

2006-02-12 Thread John J. Lee
Kevin Walzer <[EMAIL PROTECTED]> writes: [...] > Commercial Qt is a little out of my price range. Commercial *PyQt* (including a license for Qt for use only with PyQt) is $400 (USD) per developer (plus an extra $300/year if you want upgrades). That's compared to Qt license for use *with C++* vary

Re: by reference

2006-02-12 Thread dirvine
Yes I did I was trying to do something like (pseudo code) write: get files in path for each filename get size, type create dic called filename assign size:xx,type:y pickle to file read: open pickled file read dict name and contents (hoping unpickling file gives me the dict name as it was saved,

Re: Tracking down memory leaks?

2006-02-12 Thread John J. Lee
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sun, 12 Feb 2006 05:11:02 -0800, MKoool wrote: [...] > I may be mistaken, and if so I will welcome the correction, but Python > does not return memory to the operating system until it terminates. > > Objects return memory to Python when they are gar

Re: Tracking down memory leaks?

2006-02-12 Thread MKoool
> How big is the file you are reading in? If it is (say) 400 MB, then it is > hardly surprising that you will be using 500MB of RAM. If the file is 25K, > that's another story. Actually, I am downloading the matrix data from a file on a server on the net using urllib2, and then I am running severa

Re: Need a bit of help with a list..

2006-02-12 Thread Alex Martelli
rh0dium <[EMAIL PROTECTED]> wrote: ... > Why doesn't this work as expected.. I expect that the the lines within > the sections will get modified - permanently. It is modifying them > during the first section but they never get saved to the new values.. > Can anyone help me and even better expl

Need a bit of help with a list..

2006-02-12 Thread rh0dium
Hi all, Why doesn't this work as expected.. I expect that the the lines within the sections will get modified - permanently. It is modifying them during the first section but they never get saved to the new values.. Can anyone help me and even better explain why it's not working.. for

Re: Clearing the screen

2006-02-12 Thread Fredrik Lundh
"mwt" wrote: > Arrgghh... Is there any way to edit posts on this thing? are you aware that you're posting to a usenet newsgroup? > The os.system("clear") doesn't work at all in a module. works for me (as long as I'm running the code on a platform that has a clear command). in what way does it

Re: How to invoke a tkinter menu *itself*

2006-02-12 Thread James Stroud
Edward K. Ream wrote: > Hi, > > > > I've spent a pleasant hour or so trying to bring up a top-level Tk menu at > the same spot as it would appear if I had actually clicked the menu. That > is, I want to bring up a menu from the keyboard. > > > > The problem is computing the x and y args to

Re: Another n00b: Removing the space in "print 'text', var"

2006-02-12 Thread Felipe Almeida Lessa
Em Dom, 2006-02-12 às 22:11 +, HappyHippy escreveu: > More of a minor niggle than anything but how would I remove the > aforementioned space? > > eg. > strName = 'World' > print 'Hello', strName, ', how are you today?' > > comes out as "Hello World , how are you today?" strname = 'World' pr

Re: Another n00b: Removing the space in "print 'text', var"

2006-02-12 Thread Alex Martelli
HappyHippy <[EMAIL PROTECTED]> wrote: > More of a minor niggle than anything but how would I remove the > aforementioned space? > > eg. > strName = 'World' > print 'Hello', strName, ', how are you today?' > > comes out as "Hello World , how are you today?" > > Have googled, and worked my way t

Re: Another n00b: Removing the space in "print 'text', var"

2006-02-12 Thread Fredrik Lundh
"HappyHippy" wrote: > More of a minor niggle than anything but how would I remove the > aforementioned space? > > eg. > strName = 'World' > print 'Hello', strName, ', how are you today?' > > comes out as "Hello World , how are you today?" > > Have googled, and worked my way through the first 7 cha

Re: Determining an operating system's default browser

2006-02-12 Thread Paul Boddie
Jorgen Grahn wrote: > On 11 Feb 2006 11:44:29 -0800, Paul Boddie <[EMAIL PROTECTED]> wrote: > > > > Indeed. Thanks for reminding me about mailcap/metamail - I used them in > > And thanks for mentioning the real name of that mechanism! Happy memories! ;-) [...] > > import mailcap > > I guess I sh

Another n00b: Removing the space in "print 'text', var"

2006-02-12 Thread HappyHippy
More of a minor niggle than anything but how would I remove the aforementioned space? eg. strName = 'World' print 'Hello', strName, ', how are you today?' comes out as "Hello World , how are you today?" Have googled, and worked my way through the first 7 chapters of Byte of Python, but to no a

Re: PEP 353: Using ssize_t as the index type

2006-02-12 Thread Martin v. Löwis
Tony Nelson wrote: > Minor typo: "too" Thanks, fixed. Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Netstat in python. Does it's possible?

2006-02-12 Thread Martin v. Löwis
Jorgen Grahn wrote: > I was thinking mostly about /proc, /sys and related file systems. I have a > feeling parts of them they change quite frequently under Linux, and of > course under other Unices they may look completely different, or be absent. > > Like Mr Laird said elsewhere, the best thing m

Re: Single-file executables

2006-02-12 Thread Martin v. Löwis
Thomas Heller wrote: > I wonder if anyone is actually using freeze on Windows, with scripts > that use, say, pywin32 and wxPython. Interesting question. I've never done so myself (only on Linux and Solaris), and given the relatively small interest in having a static Python library on Windows, I g

Re: Downloading Large Files -- Feedback?

2006-02-12 Thread Alex Martelli
mwt <[EMAIL PROTECTED]> wrote: ... > The process is pretty opaque, however. This downloads and writes the > file with no feedback whatsoever. You don't see how many bytes you've > downloaded already, etc. Especially the "g = f.read()" step just sits > there while downloading a large file, presen

Re: python and webcam

2006-02-12 Thread dfaber
Hi again, I've tried a the Sane interface from PIL and I get the following error, when I run the demo_pil.py from the Sane directory. SANE version: (16777231, 1, 0, 15) Available devices= [('v4l:/dev/video0', 'Noname', 'Logitech QuickCam

Re: Downloading Large Files -- Feedback?

2006-02-12 Thread mwt
Pardon my ignorance here, but could you give me an example of what would constitute file that is unreasonably or dangerously large? I'm running python on a ubuntu box with about a gig of ram. Also, do you know of any online examples of the kind of robust, real-world code you're describing? Thank

Re: Is Forth for real?

2006-02-12 Thread Daniel Ciesinger
Steven D'Aprano schrieb: > On Sun, 12 Feb 2006 17:08:02 +, Cameron Laird wrote: > > >>In article <[EMAIL PROTECTED]>, >>Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >>>on the web for each language. By comparison, even Forth gives 13 million >>>plus hits, and who uses Forth? 13m hits for fo

Re: Determining an operating system's default browser

2006-02-12 Thread Jorgen Grahn
On 11 Feb 2006 11:44:29 -0800, Paul Boddie <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: ... >> On my machines, there is One Correct Way of doing these things, and that's >> to look in the MIME support/configuration files (~/.mailcap, and so on), >> first for the user, then system-wide. Somethin

Re: python and webcam

2006-02-12 Thread Terry Reedy
"dfaber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > I have Logitech webcam and I need to grab images on Fedora Core 4 (not > my favorite distro). Are there any python modules available for doing > this? Any hints or suggestions would be welcome. If is one of their ball c

Re: Single-file executables

2006-02-12 Thread Thomas Heller
Martin v. Löwis wrote: > Kevin Walzer wrote: >> The apps I've seen created by py2exe aren't single-file at all, the >> install folder is full of files besides the main program. I'm >> looking for a solution that stuffs all libraries, scripts, and the >> Python runtime into one file. Usually the

Re: Small newbie question

2006-02-12 Thread Astan Chee
Byte wrote: >How would I do this: Write a program that simply outputs a ramdom (in >this case) name of (for this example) a Linux distibution. Heres the >code ive tryed: > >from random import uniform >from time import sleep > >x = 2 >while x < 5: >x = uniform(1, 5) >if x >= 1 <= 1.999: p

Re: Tracking down memory leaks?

2006-02-12 Thread Robert
MKoool wrote: > I have an application with one function called "compute", which given a > filename, goes through that file and performs various statistical > analyses. It uses arrays extensively and loops alot. it prints the > results of it's statistical significance tests to standard out. Sinc

Re: python and webcam

2006-02-12 Thread dfaber
Thank you for your help. I will look around for v4l modules too. -- http://mail.python.org/mailman/listinfo/python-list

Re: Netstat in python. Does it's possible?

2006-02-12 Thread Jorgen Grahn
On Sun, 12 Feb 2006 01:04:14 +0100, Martin v. Löwis <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: >> There might still be a problem for people doing things like this: netstat >> might use unstable or non-public APIs to find the things it lists. This is >> fine because it's typically your OS vend

Re: super(...).__init__() vs Base.__init__(self)

2006-02-12 Thread Jan Niklas Fingerle
Steven Bethard <[EMAIL PROTECTED]> wrote: > Jan Niklas Fingerle wrote: > > Steven Bethard <[EMAIL PROTECTED]> wrote: > >> Personally, I'd call the lack of the super calls in threading.Thread and > >> Base bugs. > > > > It can't be a bug since it wasn't a bug before super was introduced and > >

Re: python and webcam

2006-02-12 Thread Fredrik Lundh
"dfaber" <[EMAIL PROTECTED]> wrote: > It is a Win32 Python Extension. I am looking for something that work > on Linux. here's one: http://antonym.org/libfg (for more alternatives, google for "python webcam linux" or some variation thereof) -- http://mail.python.org/mailman/listinfo/p

Re: python and webcam

2006-02-12 Thread dfaber
It is a Win32 Python Extension. I am looking for something that work on Linux. -- http://mail.python.org/mailman/listinfo/python-list

[ANN] svnmock 0.3 released

2006-02-12 Thread Collin Winter
Hello all, Version 0.3 of `svnmock`, a package for testing Python applications that use Subversion's Python bindings, has been released. `svnmock` emulates the entire suite of Python bindings, allowing developers to ensure that their application is calling the expected API functions with the expec

Re: is there a better way?

2006-02-12 Thread drrngrvy
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a écrit : > > Problem: > > > > You have a list of unknown length, > > This doesn't exist in Python: >len(alist) > > > such as this: list > [X,X,X,O,O,O,O]. You want to extract all and only the > > X's. > > braindead solution - relying on zeros b

Re: super(...).__init__() vs Base.__init__(self)

2006-02-12 Thread Jan Niklas Fingerle
Tony Nelson <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Jan Niklas Fingerle <[EMAIL PROTECTED]> wrote: > > > ...Super is a good tool to use, when dealing with > > diamond shape inheritance. In any other case I would use the direct > > calls to the base classes. In fact, i've ye

Re: python and webcam

2006-02-12 Thread Philippe Bouige
In article <[EMAIL PROTECTED]>, dfaber wrote: > I have Logitech webcam and I need to grab images on Fedora Core 4 (not >my favorite distro). Are there any python modules available for doing >this? Any hints or suggestions would be welcome. You can try this : http://videocapture.s

Re: Mental Abuse

2006-02-12 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > My abuser has been using the medical device to harass me the last 4-5 > years. I have no idea what type of a device is being used on me. I > believe the device is only available to licensed pharmacist(s). I am > not very familiar with the intend usage of the device. Can

Re: Small newbie question

2006-02-12 Thread Paul Rubin
> while x < 5: > x = uniform(1, 5) > if x >= 1 <= 1.999: print 'SuSE' > ... > It dosnt work: only keep printing SuSE. Please help, Try this: x = 27.6 if x >= 1 <= 1.999: print 'SuSE' It prints 'SuSE' because the test is written incorrectly. You want: if 1 <= x <= 1.999: p

Re: Small newbie question

2006-02-12 Thread Byte
Great stuff, thanks: -- /usr/bin/byte -- http://mail.python.org/mailman/listinfo/python-list

Re: Small newbie question

2006-02-12 Thread Tim Parkin
Byte wrote: > How would I do this: Write a program that simply outputs a ramdom (in > this case) name of (for this example) a Linux distibution. Heres the > code ive tryed: > > from random import uniform > from time import sleep > > x = 2 > while x < 5: > x = uniform(1, 5) > if x >= 1 <=

Ruby/Python Continuations: Turning a block callback into a read()-method ?

2006-02-12 Thread Robert
After failing on a yield/iterator-continuation problem in Python (see below) I tried the Ruby (1.8.2) language first time on that construct: The example tries to convert a block callback interface (Net::FTP.retrbinary) into a read()-like iterator function in order to virtualize the existing FTP cla

Re: Downloading Large Files -- Feedback?

2006-02-12 Thread Paul Rubin
"mwt" <[EMAIL PROTECTED]> writes: > f = urllib.urlopen("http://www.python.org/blah/blah.zip";) > g = f.read() # ... > So my question is, what is a good way to go about coding this kind of > basic feedback? Also, since my testing has only *worked* with this > code, I'm curious if it will throw a

Downloading Large Files -- Feedback?

2006-02-12 Thread mwt
This code works fine to download files from the web and write them to the local drive: import urllib f = urllib.urlopen("http://www.python.org/blah/blah.zip";) g = f.read() file = open("blah.zip", "wb") file.write(g) file.close() The process is pretty opaque, however. This downloads and writes t

Re: Single-file executables

2006-02-12 Thread Ravi Teja
As Peter later pointed out, that is a licencing issue rather than a tool issue. After browsing through the PyInstaller documentation, I came across a curious snippet. "On Windows, this provides support for doing in-process COM servers. It is not generalized. However, embedders can follow the same

Re: PEP 353: Using ssize_t as the index type

2006-02-12 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: ... > Discussion > == > > Why not size_t > -- > > An initial attempt to implement this feature tried to use > size_t. It quickly turned out that this cannot work: Python > uses negative indices in m

Small newbie question

2006-02-12 Thread Byte
How would I do this: Write a program that simply outputs a ramdom (in this case) name of (for this example) a Linux distibution. Heres the code ive tryed: from random import uniform from time import sleep x = 2 while x < 5: x = uniform(1, 5) if x >= 1 <= 1.999: print 'SuSE' elif x >=

Re: Tracking down memory leaks?

2006-02-12 Thread Rene Pijlman
malv: >Is there any way for making Python return memory no longer needed to >the OS? Cases may arise where you indeed need a big memory block >temporarily without being able to split it up into smaller chunks. That's not really necessary. On any decent OS it's just unused address space, that doesn

Re: ordered sets operations on lists..

2006-02-12 Thread Alex Martelli
Bengt Richter <[EMAIL PROTECTED]> wrote: ... > >Personally, I'd always use (depending on guesses regarding lengths of > >lists) [x for x in l1 if x in l2] or the setified equivalent, of course. > > > Perhaps newbies should be advised that > > [x for x in l1 if x in set(l2)] > > is not a (w

python and webcam

2006-02-12 Thread dfaber
Hi, I have Logitech webcam and I need to grab images on Fedora Core 4 (not my favorite distro). Are there any python modules available for doing this? Any hints or suggestions would be welcome. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: ordered sets operations on lists..

2006-02-12 Thread Bengt Richter
On Sat, 11 Feb 2006 10:24:04 -0800, [EMAIL PROTECTED] (Alex Martelli) wrote: >Raymond Hettinger <[EMAIL PROTECTED]> wrote: > ... >> The intersection step is unnecessary, so the answer can be simplified a >> bit: >> >> >>> filter(set(l2).__contains__, l1) >> [5, 3] >> >>> filter(set(l1).__contai

Re: Is python very slow compared to C

2006-02-12 Thread malv
That's why Microsoft is bringing IronPython on board to have something more decent available with .NET -- http://mail.python.org/mailman/listinfo/python-list

Re: Tracking down memory leaks?

2006-02-12 Thread malv
Hi Steven, Is there any way for making Python return memory no longer needed to the OS? Cases may arise where you indeed need a big memory block temporarily without being able to split it up into smaller chunks. Thank you. malv Steven D'Aprano wrote: > Objects return memory to Python when they a

Re: Too Many if Statements?

2006-02-12 Thread Bengt Richter
On Sat, 11 Feb 2006 15:40:49 -0500, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > >"Steve Holden" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Clearly it would be a good idea to remove whatever problem is causing >> the error, > >The problem (see my post of the com_backpatch code)

Re: Too Many if Statements?

2006-02-12 Thread slogging_away
Now that I know the root cause of the problem, I can write around it as suggested by Steve Holden and Terry Reedy, (and others). In fact, it has helped me in a way as I am thinking not in terms of the easiest solution, (read; the first one that comes to mind), but more effcient and cleaner ways t

Re: Is python very slow compared to C

2006-02-12 Thread Michael Tobis
> Read his post again. He didn't ask a specific question at all, and he > certainly didn't mention execution speed. agreed > He asked a vague, meaningless question about whether Python was "slow > compared to C". No, that is both wrong and gratuitously harsh. He had heard vague meaningless com

Re: Can I get the 8bit-string representation of any unicode string

2006-02-12 Thread wanghz
Hi, I see. Thank you for your help! Regards, hongzheng Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote > > > I may misunderstood it. I will think about it carefully. > > > > By the way, does python has a interface, just like iconv in libc for > > C/C++? Or, how can I convert a string from a e

  1   2   >