Re: Python Threads and C Semaphores

2007-01-16 Thread Dejan Rodiger
Jeremy said the following on 16.1.2007 8:27: Hello, I have a fat C++ extension to a Python 2.3.4 program. In all, I count five threads. Of these, two are started in Python using thread.start_new_thread(), and both of these wait on semaphores in the C++ extension using sem_wait(). There also

why scipy cause my program slow?

2007-01-16 Thread HYRY
Why the exec time of test(readdata()) and test(randomdata()) of following program is different? my test file 150Hz10dB.wav has 2586024 samples, so I set randomdata function to return a list with 2586024 samples. the exec result is: 2586024 type 'list' 10.8603842736 2586024 type 'list'

Re: why scipy cause my program slow?

2007-01-16 Thread Robert Kern
HYRY wrote: Why the exec time of test(readdata()) and test(randomdata()) of following program is different? my test file 150Hz10dB.wav has 2586024 samples, so I set randomdata function to return a list with 2586024 samples. the exec result is: 2586024 type 'list' 10.8603842736 2586024

Re: installing/maintaining modules for multiple versions of python

2007-01-16 Thread Daniel Nogradi
I have a suse box that has by default python 2.4 running and I have a 2.5 version installed in /reg/python2.5. How do I install new modules for only 2.5 without disturbing the 2.4 default installation. If you do 'python2.5 setup.py install' on a new module supporting distutils it will only

Re: for v in l:

2007-01-16 Thread Peter Otten
Gert Cuykens wrote: is there a other way then this to loop trough a list and change the values i=-1 for v in l: i=i+1 l[i]=v+x something like for v in l: l[v]=l[v]+x Be generous, create a new list: items =

Re: why scipy cause my program slow?

2007-01-16 Thread HYRY
Thanks, by your hint, I change type(data) to type(data[0]), and I get type 'float' type 'numpy.float64' So, calculate with float is about 5x faster numpy.float64. Robert Kern wrote: HYRY wrote: Why the exec time of test(readdata()) and test(randomdata()) of following program is different?

Re: html + javascript automations = [mechanize + ?? ] or something else?

2007-01-16 Thread Benjamin Niemann
Hello, John wrote: John wrote: I have to write a spyder for a webpage that uses html + javascript. I had it written using mechanize but the authors of the webpage now use a lot of javascript. Mechanize can no longer do the job. Does anyone know how I could automate my spyder to understand

How to convert float to sortable integer in Python

2007-01-16 Thread shellon
Hi all: I want to convert the float number to sortable integer, like the function float2rawInt() in java, but I don't know the internal expression of float, appreciate your help! -- http://mail.python.org/mailman/listinfo/python-list

Re: How naive is Python?

2007-01-16 Thread skip
John == John Machin [EMAIL PROTECTED] writes: John [EMAIL PROTECTED] wrote: John Sorry, Skip, but I find that very hard to believe. The foo() John function would take quadratic time if it were merely adding on John pieces of constant size -- however len(str(i)) is not a constant,

Re: How to convert float to sortable integer in Python

2007-01-16 Thread Steven D'Aprano
On Tue, 16 Jan 2007 01:21:52 -0800, shellon wrote: Hi all: I want to convert the float number to sortable integer, like the function float2rawInt() in java, but I don't know the internal expression of float, appreciate your help! Google says: Your search - float2rawInt - did not match

Re: Maths error

2007-01-16 Thread Nick Maclaren
In article [EMAIL PROTECTED], Hendrik van Rooyen [EMAIL PROTECTED] writes: | | [ Interval arithmetic ] | | | For people just getting into it, it can be shocking to realize just how | | wide the interval can become after some computations. | | Yes. Even when you can prove (mathematically)

Re: Segfault with tktreectrl on python-2.5 on linux

2007-01-16 Thread klappnase
Anton Hartl schrieb: snip Solutions: a) convince Python developers to prefix ALL new (wrt. 2.5) global symbols with a prefix like _PyAST_ or equivalent; this would be consistent with how it is done anyway, unfortunately the new AST symbols deviate from this

Re: I wrote a C++ code generator in Python, would anyone please help me to review the code? :)

2007-01-16 Thread Vineeth Kashyap
Hi, I am interested in your proposal. I am basically a C/C++ programmer, but recently fell in love with python. Please send more details on fgen. We could probably start working. :) Kevin Wan wrote: fgen is a free command line tool that facilitates cross platform c++ development, including

Re: html + javascript automations = [mechanize + ?? ] or something else?

2007-01-16 Thread Andrey Khavryuchenko
John, J == John wrote: J I have to write a spyder for a webpage that uses html + javascript. I J had it written using mechanize but the authors of the webpage now use a J lot of javascript. Mechanize can no longer do the job. Does anyone J know how I could automate my spyder to understand

Re: html + javascript automations = [mechanize + ?? ] or something else?

2007-01-16 Thread Diez B. Roggisch
Up to my knowledge, there no way to test javascript but to fire up a browser. So, you might check Selenium (http://www.openqa.org/selenium/) and its python module. No use in that, as to be remote-controlled by python, selenium must be run on the server-site itself, due to JS security model

Re: How to convert float to sortable integer in Python

2007-01-16 Thread robert
shellon wrote: Hi all: I want to convert the float number to sortable integer, like the function float2rawInt() in java, but I don't know the internal expression of float, appreciate your help! float comparision works well enough for sorting in Python. What is the actual requirement?

Regular expressions question

2007-01-16 Thread Victor Polukcht
I have 2 strings: Global etsi3 *200 ok30 100% 100% Outgoing and Global etsi3 * 4 ok 30 100% 100% Outgoing The difference is *200 instead of * 4. Is there ability to write a regular expression that will match both of that strings? --

Re: html + javascript automations = [mechanize + ?? ] or something else?

2007-01-16 Thread Duncan Booth
John [EMAIL PROTECTED] wrote: Is there a way to control a browser like firefox from python itself? How about IE? IE is easy enough to control and you have full access to the DOM: import win32com win32com.client.gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7EB- C05BAE0B}', 0, 1, 1) module

Re: pyExcelerator big integer values

2007-01-16 Thread Gacha
John Machin wrote: Here's a possible replacement -- I say possible because you have been rather coy about what you are actually trying to do. value = values[(row_idx, col_idx)]) if isinstance(value, float): v = repr(value) else: v = unicode(value) HTH John My final result:

Re: Regular expressions question

2007-01-16 Thread Duncan Booth
Victor Polukcht [EMAIL PROTECTED] wrote: I have 2 strings: Global etsi3 *200 ok30 100% 100% Outgoing and Global etsi3 * 4 ok 30 100% 100% Outgoing The difference is *200 instead of * 4. Is there ability to write a regular

Re: How to convert float to sortable integer in Python

2007-01-16 Thread Duncan Booth
robert [EMAIL PROTECTED] wrote: shellon wrote: Hi all: I want to convert the float number to sortable integer, like the function float2rawInt() in java, but I don't know the internal expression of float, appreciate your help! float comparision works well enough for sorting in

Re: why scipy cause my program slow?

2007-01-16 Thread robert
HYRY wrote: Thanks, by your hint, I change type(data) to type(data[0]), and I get type 'float' type 'numpy.float64' So, calculate with float is about 5x faster numpy.float64. approx.. numpy funcs all upcast int to int32 and float to float32 and int32/float to float32 etc. This is probably

Projects anyone?

2007-01-16 Thread placid
Hi all, I'm looking for anyone who is working on a project at the moment that needs help (volunteer). The last project i worked on personally was screen-scraping MySpace profiles (read more at the following link) http://placid.programming.projects.googlepages.com/screen-scrapingmyspaceprofiles

Re: How to convert float to sortable integer in Python

2007-01-16 Thread Wolfgang Grafen
shellon wrote: Hi all: I want to convert the float number to sortable integer, like the function float2rawInt() in java, but I don't know the internal expression of float, appreciate your help! You should know you can sort mixed float/integer values in Python l=[3,2.3,1.45,2,5]

wxPython, having images in a textCtrl

2007-01-16 Thread Erik
Is it possible with wxPython to place images in a textctrl (or a styledtextctrl)? If you don't get what I mean, just think about emoticons in the MSN messenger chat window. So is it possible to use images in a textCtrl? Thanks Erik -- http://mail.python.org/mailman/listinfo/python-list

Re: Anyone has a nice view_var procedure ?

2007-01-16 Thread Neil Cerutti
On 2007-01-15, Gabriel Genellina [EMAIL PROTECTED] wrote: At Monday 15/1/2007 17:45, Stef Mientki wrote: Is there some handy/ nice manner to view the properties of some variable ? As a newbie, I often want to see want all the properties of a var, and also some corner values (large arrays) etc.

Re: assert versus print [was Re: The curious behavior of integer objects]

2007-01-16 Thread Ron Adam
Carl Banks wrote: Ron Adam wrote: There have been times where I would like assert to be a little more assertive than it is. :-) ie.. not being able to turn them off with the -0/-00 switches, and having them generate a more verbose traceback. Personally, I'd rather see it get less

Re: Anyone has a nice view_var procedure ?

2007-01-16 Thread Duncan Booth
Neil Cerutti [EMAIL PROTECTED] wrote: dir( [object]) [...] The list is not necessarily complete. If the object is a module object, the list contains the names of the module's attributes. If the object is a type or class object, the list contains the names of its attributes,

Re: whats wrong with my reg expression ?

2007-01-16 Thread Neil Cerutti
On 2007-01-15, Gert Cuykens [EMAIL PROTECTED] wrote: thx PS i also cant figure out what is wrong here ? rex=re.compile('^(?Pvalue[^]*)$',re.M) for v in l: v=rex.match(v).group('value') v=v.replace('','') return(l)

re.sub and empty groups

2007-01-16 Thread Hugo Ferreira
Hi! I'm trying to do a search-replace in places where some groups are optional... Here's an example: re.match(rImage:([^\|]+)(?:\|(.*))?, Image:ola).groups() ('ola', None) re.match(rImage:([^\|]+)(?:\|(.*))?, Image:ola|).groups() ('ola', '') re.match(rImage:([^\|]+)(?:\|(.*))?,

Re: html + javascript automations = [mechanize + ?? ] or something else?

2007-01-16 Thread Andrey Khavryuchenko
Diez, DBR == Diez B Roggisch wrote: Up to my knowledge, there no way to test javascript but to fire up a browser. So, you might check Selenium (http://www.openqa.org/selenium/) and its python module. DBR No use in that, as to be remote-controlled by python, selenium must be run DBR

Globbing files by their creation date

2007-01-16 Thread tkpmep
I'd like to create a list of all files in a directory that were created after a certain date. How does one do this? I've used glob.glob to create a list of all files whose name matches a substring, but I don't see how I can use it to identify files by their creation date. Thanks in advance for

Re: assert versus print [was Re: The curious behavior of integer objects]

2007-01-16 Thread Neil Cerutti
On 2007-01-16, Ron Adam [EMAIL PROTECTED] wrote: I have to admit that part of why assert seems wrong to me is the meaning of the word implies something you shouldn't be able to ignore. While warnings seem like something that can be disregarded. Experienced C coders expect assert to behave

Re: Globbing files by their creation date

2007-01-16 Thread skip
Thomas I've used glob.glob to create a list of all files whose name Thomas matches a substring, but I don't see how I can use it to Thomas identify files by their creation date. Sumthin' like: files = [f for f in glob.glob(globpat) if os.path.getctime(f)

Re: re.sub and empty groups

2007-01-16 Thread harvey . thomas
Hugo Ferreira wrote: Hi! I'm trying to do a search-replace in places where some groups are optional... Here's an example: re.match(rImage:([^\|]+)(?:\|(.*))?, Image:ola).groups() ('ola', None) re.match(rImage:([^\|]+)(?:\|(.*))?, Image:ola|).groups() ('ola', '')

Re: re.sub and empty groups

2007-01-16 Thread harvey . thomas
Hugo Ferreira wrote: Hi! I'm trying to do a search-replace in places where some groups are optional... Here's an example: re.match(rImage:([^\|]+)(?:\|(.*))?, Image:ola).groups() ('ola', None) re.match(rImage:([^\|]+)(?:\|(.*))?, Image:ola|).groups() ('ola', '')

Re: Watch log

2007-01-16 Thread Salvatore Di Fazio
Thinker ha scritto: What you want is something like 'tail -f' in linux. If you look into it's source code, you will find it check file periodically. When a read() reach the end of the file, read() will return a empty string. You can try to read data from the file periodically after a EOF. I

Re: Watch log

2007-01-16 Thread Salvatore Di Fazio
Michele Simionato ha scritto: You may begin from this: Tnx Michele -- http://mail.python.org/mailman/listinfo/python-list

Re: Debugging SocketServer.ThreadingTCPServer

2007-01-16 Thread Jean-Paul Calderone
On Tue, 16 Jan 2007 00:23:35 -0500, Stuart D. Gathman [EMAIL PROTECTED] wrote: I have a ThreadingTCPServer application (pygossip, part of http://sourceforge.net/projects/pymilter). It mostly runs well, but occasionally goes into a loop. How can I get a stack trace of running threads to figure

Re: Command line arguments on Vista

2007-01-16 Thread jmike
Thanks for the answers; that was the problem exactly. --JMike Duncan Booth wrote: It sounds like the registry entry for running Python files is messed up. Can you go to a command line and see what the command 'ftype Python.File' displays? (Assuming that command lines and ftype still work on

Re: Regular expressions question

2007-01-16 Thread Victor Polukcht
Actually, i'm trying to get the values of first field (Global) , fourth (200, 4), and fifth (100%) and sixth (100%). Everything except fourth is simple. On Jan 16, 2:59 pm, Duncan Booth [EMAIL PROTECTED] wrote: Victor Polukcht [EMAIL PROTECTED] wrote: I have 2 strings: Global

Re: Regular expressions question

2007-01-16 Thread Neil Cerutti
On 2007-01-16, Victor Polukcht [EMAIL PROTECTED] wrote: Actually, i'm trying to get the values of first field (Global) , fourth (200, 4), and fifth (100%) and sixth (100%). Everything except fourth is simple. g = Global etsi3 * 4 ok 30 100% 100% Outgoing import re r =

urrlib2 multithreading error

2007-01-16 Thread viscanti
Hi, I'm using urllib2 to retrieve some data usign http in a multithreaded application. Here's a piece of code: req = urllib2.Request(url, txdata, txheaders) opener = urllib2.build_opener() opener.addheaders = [('User-agent', user_agent)]

Re: Regular expressions question

2007-01-16 Thread Victor Polukcht
The same regular expression should work for another string (with *200). On Jan 16, 5:40 pm, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-01-16, Victor Polukcht [EMAIL PROTECTED] wrote: Actually, i'm trying to get the values of first field (Global) , fourth (200, 4), and fifth (100%) and

Re: Regular expressions question

2007-01-16 Thread Neil Cerutti
On 2007-01-16, Victor Polukcht [EMAIL PROTECTED] wrote: On Jan 16, 5:40 pm, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-01-16, Victor Polukcht [EMAIL PROTECTED] wrote: Actually, i'm trying to get the values of first field (Global) , fourth (200, 4), and fifth (100%) and sixth (100%).

Re: Regular expressions question

2007-01-16 Thread Wolfgang Grafen
Victor Polukcht wrote: I have 2 strings: Global etsi3 *200 ok30 100% 100% Outgoing and Global etsi3 * 4 ok 30 100% 100% Outgoing The difference is *200 instead of * 4. Is there ability to write a regular expression that

arguments of a function/metaclass

2007-01-16 Thread rubbishemail
Hello, I have a member function with many (20) named arguments def __init__(self,a=1,b=2): self.a=a self.b=b I would like to get rid of the many redundant lines like self.a=a and set the members automatically. The list of default arguments could be given like def __init__(**kwargs):

Search Queue

2007-01-16 Thread abcd
I have a class such as... id = 0 class Foo: def __init__(self, data): self.id = id id += 1 self.data = data And I am storing them in a Queue.Queue... import Queue q = Queue.Queue() q.put(Foo('blah')) q.put(Foo('hello world')) q.put(Foo('test')) how can I search q

Re: Projects anyone?

2007-01-16 Thread stef
placid wrote: Hi all, I'm looking for anyone who is working on a project at the moment that needs help (volunteer). The last project i worked on personally was screen-scraping MySpace profiles (read more at the following link)

Re: Conflicting needs for __init__ method

2007-01-16 Thread Mark Dickinson
On Jan 15, 4:54 pm, Ben Finney [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: Suppose you're writing a class Rational for rational numbers. The __init__ function of such a class has two quite different roles to play. That should be your first clue to question whether you're actually

Re: Regular expressions question

2007-01-16 Thread Jussi Salmela
Victor Polukcht kirjoitti: I have 2 strings: Global etsi3 *200 ok30 100% 100% Outgoing and Global etsi3 * 4 ok 30 100% 100% Outgoing The difference is *200 instead of * 4. Is there ability to write a regular expression that

Re: Projects anyone?

2007-01-16 Thread Peter Decker
On 16 Jan 2007 04:07:50 -0800, placid [EMAIL PROTECTED] wrote: Hi all, I'm looking for anyone who is working on a project at the moment that needs help (volunteer). The last project i worked on personally was screen-scraping MySpace profiles (read more at the following link)

Re: assert versus print [was Re: The curious behavior of integer objects]

2007-01-16 Thread Ron Adam
Neil Cerutti wrote: On 2007-01-16, Ron Adam [EMAIL PROTECTED] wrote: I have to admit that part of why assert seems wrong to me is the meaning of the word implies something you shouldn't be able to ignore. While warnings seem like something that can be disregarded. Experienced C

connection to server not accepted (but no error) only after several hours

2007-01-16 Thread seb
Hi, this simple server (time protocol) does not respond after a few hours, even when it is restarted. The behaviour looks to me like a firewall blocking but I have desabled the firewall. Using Netstat - a I find the server listed when it is running and not listed when I stop it. The server starts

Re: Search Queue

2007-01-16 Thread Bill Scherer
abcd wrote: I have a class such as... id = 0 class Foo: def __init__(self, data): self.id = id id += 1 self.data = data And I am storing them in a Queue.Queue... import Queue q = Queue.Queue() q.put(Foo('blah')) q.put(Foo('hello world')) q.put(Foo('test')) how can

Re: Search Queue

2007-01-16 Thread Tim Golden
abcd wrote: I have a class such as... [... ] And I am storing them in a Queue.Queue... import Queue q = Queue.Queue() q.put(Foo('blah')) q.put(Foo('hello world')) q.put(Foo('test')) how can I search q for an instance of Foo which has 'id' equal to say 2? Typically a queue only lets

Re: Conflicting needs for __init__ method

2007-01-16 Thread Mark Dickinson
On Jan 16, 10:25 am, Mark Dickinson [EMAIL PROTECTED] wrote: that is, I was working from the following two assumptions: (1) *Every* time a Rational is created, __init__ must eventually be called, and (2) The user of the class expects to call Rational() to create rationals. (with apologies

urllib2 and HTTPBasicAuthHandler

2007-01-16 Thread m.banaouas
Hi all, I started to use urllib2 library and HTTPBasicAuthHandler class in order to authenticate with a http server (Zope in this case). I don't know why but it doesn't work, while authenticating with direct headers manipulation works fine! WinXP Sp2 Python 2.4.4 Thanks in advance for your

help needed for pymorph

2007-01-16 Thread azrael
Hi guys I tried to install and run pymorph but I am having some problems. when I want to use mmshow() I get the message ImportError: DLL load failed: the specified module could not be found import morph import handson def main (): arr = mmreadgray(beef.jpg); mmgshow(arr) does

sslerror: (8, 'EOF occurred in violation of protocol')

2007-01-16 Thread Roopesh
I am getting an SSL error while fetching mails from Gmail over SSL on Port 995. This problem occurs occasionally only, otherwise it works file. Any idea why it happens. Exception in thread Thread-1: Traceback (most recent call last): File c:\python24\lib\threading.py, line 442, in __bootstrap

Re: Segfault with tktreectrl on python-2.5 on linux

2007-01-16 Thread Anton Hartl
On 2007-01-16, klappnase [EMAIL PROTECTED] wrote: Solutions: a) convince Python developers to prefix ALL new (wrt. 2.5) global symbols with a prefix like _PyAST_ or equivalent; this would be consistent with how it is done anyway, unfortunately the new AST symbols

Re: Search Queue

2007-01-16 Thread abcd
Yea basically I need Queue like functionality with the ability to search for a particular instance in it. I guess I could just use a list and search it as needed. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: arguments of a function/metaclass

2007-01-16 Thread Michele Simionato
[EMAIL PROTECTED] wrote: Hello, I have a member function with many (20) named arguments def __init__(self,a=1,b=2): self.a=a self.b=b I would like to get rid of the many redundant lines like self.a=a and set the members automatically. The list of default arguments could be

Re: arguments of a function/metaclass

2007-01-16 Thread Stargaming
[EMAIL PROTECTED] schrieb: Hello, I have a member function with many (20) named arguments def __init__(self,a=1,b=2): self.a=a self.b=b I would like to get rid of the many redundant lines like self.a=a and set the members automatically. The list of default arguments could

Re: Conflicting needs for __init__ method

2007-01-16 Thread BJörn Lindqvist
On 1/15/07, Ben Finney [EMAIL PROTECTED] wrote: The alternate constructors are decorated as '@classmethod' since they won't be called as instance methods, but rather: foo = Rational.from_string(355/113) bar = Rational.from_int(17) baz = Rational.from_rational(foo) I agree with

Re: arguments of a function/metaclass

2007-01-16 Thread goodwolf
[EMAIL PROTECTED] je napisao/la: Hello, I have a member function with many (20) named arguments def __init__(self,a=1,b=2): self.a=a self.b=b I would like to get rid of the many redundant lines like self.a=a and set the members automatically. The list of default arguments

Re: Conflicting needs for __init__ method

2007-01-16 Thread BJörn Lindqvist
On 1/16/07, Steven D'Aprano [EMAIL PROTECTED] wrote: On Tue, 16 Jan 2007 08:54:09 +1100, Ben Finney wrote: Think of built-ins like str() and int(). I suggest that people would be *really* unhappy if we needed to do this: str.from_int(45) str.from_float(45.0) str.from_list([45, 45.5]) etc.

Re: html + javascript automations = [mechanize + ?? ] or something else?

2007-01-16 Thread ina
John wrote: I have to write a spyder for a webpage that uses html + javascript. I had it written using mechanize but the authors of the webpage now use a lot of javascript. Mechanize can no longer do the job. Does anyone know how I could automate my spyder to understand javascript? Is there

Re: Python web app. (advice sought)

2007-01-16 Thread Tim Williams
On 16/01/07, Ralf Schönian [EMAIL PROTECTED] wrote: I would also like to vote for Karrigell. BTW: Does anyone knows how to avoid stopping/starting of the webserver after changing external libraries? I have some own modules under /opt/local/python/lib and import them by extending the path

Re: arguments of a function/metaclass

2007-01-16 Thread Gabriel Genellina
goodwolf [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] A simply solution: def __init__(self, a=1, b=2, c=3, ..): for key, val in locals().items(): if key != 'self': setattr(self.__class__, key, val) in addition: def set(self, **kwarg): for

Check a windows service

2007-01-16 Thread awel
Hi, I'm new in python and I would like to know if it's possible to check if a specific windows service is present and if it's possible how can I do? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: help needed for pymorph

2007-01-16 Thread azrael
here is the traceback http://barok.foi.hr/~ikljaic/untitled.jpg -- http://mail.python.org/mailman/listinfo/python-list

Re: Check a windows service

2007-01-16 Thread Tim Golden
awel wrote: I'm new in python and I would like to know if it's possible to check if a specific windows service is present and if it's possible how can I do? This is one way: http://tgolden.sc.sabren.com/python/wmi_cookbook.html#automatic_services You'd have to change that example slightly,

Re: Search Queue

2007-01-16 Thread Gabriel Genellina
abcd [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] Yea basically I need Queue like functionality with the ability to search for a particular instance in it. I guess I could just use a list and search it as needed. Perhaps the Queue class should be called ThreadQueue, or be

smtplib question

2007-01-16 Thread gandalf gold
Hi everyone, I was trying out smtplib and found out that I can email to anyone in my domain but not to an email address not in the domain. From browsing on the web, it seems that this has to do with the configuration of the mail server. The mail server in my organization is MS exchange.

A note on heapq module

2007-01-16 Thread bearophileHUGS
In few minutes I have just written this quite raw class, it lacks doctring (the same of the functions of the heapq module), it may contain bugs still, I haven't tested it much. It's just a simple wrapper around some of the functions of the heapq module (nsmallest and nlargest are missing). Usually

Re: Check a windows service

2007-01-16 Thread Chris Mellon
On 16 Jan 2007 09:09:34 -0800, Tim Golden [EMAIL PROTECTED] wrote: awel wrote: I'm new in python and I would like to know if it's possible to check if a specific windows service is present and if it's possible how can I do? This is one way:

Re: Check a windows service

2007-01-16 Thread Gabriel Genellina
awel [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] I'm new in python and I would like to know if it's possible to check if a specific windows service is present and if it's possible how can I do? Yes, using the wmi module, but you'll have to search the Microsoft

Re: arguments of a function/metaclass

2007-01-16 Thread goodwolf
Gabriel Genellina je napisao/la: goodwolf [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] A simply solution: def __init__(self, a=1, b=2, c=3, ..): for key, val in locals().items(): if key != 'self': setattr(self.__class__, key, val) in

Re: A note on heapq module

2007-01-16 Thread Steven Bethard
[EMAIL PROTECTED] wrote: some time ago I have written a bug into small program that uses the functions of the heapq module, because I have added an item to the head of the heap using a normal list method, breaking the heap invariant. I know I've had similar bugs in my code before. from

Python for Maemo -- new version released

2007-01-16 Thread Osvaldo Santana
We from INdT (Nokia Institute of Technology -- Brazil) have the pleasure to announce the new version of Python for Maemo, for Maemo SDK 2.1 (Scirocco) and SDK 3.0 (Bora). Highlights of this version: * Support for Nokia N800[1] device/software (SDK 3.0) * Language updated to Python 2.5 * Updated

Re: smtplib question

2007-01-16 Thread Tim Williams
On 16/01/07, gandalf gold [EMAIL PROTECTED] wrote: Hi everyone, I was trying out smtplib and found out that I can email to anyone in my domain but not to an email address not in the domain. From browsing on the web, it seems that this has to do with the configuration of the mail server. The

PyQt: QListviewItemIterator

2007-01-16 Thread Tina I
Hi, I'm fairly new to both Python and Qt so please bare with me. I have a QListView with a number of columns. In order to filter the output I iterate using QListViewItemIterator looking for the string entered by the user (filterString). Currently I do it this way: it =

Re: A note on heapq module

2007-01-16 Thread bearophileHUGS
I think the sort has to be simplified, otherwise it can't keep the heap invariant... def sort(self): self.h.sort() Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expressions question

2007-01-16 Thread Victor Polukcht
Great thnx. It works. On Jan 16, 6:02 pm, Wolfgang Grafen [EMAIL PROTECTED] wrote: Victor Polukcht wrote: I have 2 strings: Global etsi3 *200 ok30 100% 100% Outgoing and Global etsi3 * 4 ok 30 100% 100% Outgoing The

Re: urllib2 and HTTPBasicAuthHandler

2007-01-16 Thread Max Erickson
m.banaouas [EMAIL PROTECTED] wrote: Hi all, I started to use urllib2 library and HTTPBasicAuthHandler class in order to authenticate with a http server (Zope in this case). I don't know why but it doesn't work, while authenticating with direct headers manipulation works fine! ...

Re: A note on heapq module

2007-01-16 Thread Jussi Salmela
[EMAIL PROTECTED] kirjoitti: I think the sort has to be simplified, otherwise it can't keep the heap invariant... def sort(self): self.h.sort() Bye, bearophile And __repr__ should be something like this: = def __repr__(self): if self.h: return

Re: help needed for pymorph

2007-01-16 Thread azrael
yes, in the PIL directory Dennis Lee Bieber je napisao/la: On 16 Jan 2007 08:07:09 -0800, azrael [EMAIL PROTECTED] declaimed the following in comp.lang.python: does anyone have any idea how to fix it. Well, the last line of your traceback indicates that the error is somewhere

Re: whats wrong with my reg expression ?

2007-01-16 Thread Gert Cuykens
thx it works now -- http://mail.python.org/mailman/listinfo/python-list

Re: A note on heapq module

2007-01-16 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: In few minutes I have just written this quite raw class, I'd suggest some changes. It is nice to have Heaps with equal contents equal no matter what order the inserts have been done. Consider how you want Heap([1, 2, 3]) and Heap([3, 1, 2]) to behave. Similarly, it

Re: A note on heapq module

2007-01-16 Thread Scott David Daniels
Scott David Daniels wrote: Sorry, I blew the __ne__: def __ne__(self, other): return not isinstance(other, Heap) or self.h != other.h return not isinstance(other, self.__class__) and sorted( self.h) != sorted(other.h) Should be:

How can I create a linked list in Python?

2007-01-16 Thread Dongsheng Ruan
with a cell class like this: #!/usr/bin/python import sys class Cell: def __init__( self, data, next=None ): self.data = data self.next = next def __str__( self ): return str( self.data ) def echo( self ): print self.__str__() --

Re: Segfault with tktreectrl on python-2.5 on linux

2007-01-16 Thread klappnase
Anton Hartl schrieb: The bug report should go to both; I actually contacted Jeremy Hylton as a main contributor of the new AST code two weeks ago but didn't get any response. Ok, I submitted bug reports on both the tktreectrl and the python sourceforge pages. Now I'll have a nice cup of

Re: How can I create a linked list in Python?

2007-01-16 Thread Gary Herron
Dongsheng Ruan wrote: with a cell class like this: #!/usr/bin/python import sys class Cell: def __init__( self, data, next=None ): self.data = data self.next = next def __str__( self ): return str( self.data ) def echo( self ): print self.__str__() If you really

How to determine what exceptions a method might raise?

2007-01-16 Thread Ed Jensen
I'm really enjoying using the Python interactive interpreter to learn more about the language. It's fantastic you can get method help right in there as well. It saves a lot of time. With that in mind, is there an easy way in the interactive interpreter to determine which exceptions a method

Re: How can I create a linked list in Python?

2007-01-16 Thread azrael
How can I implement a linked list like the implementations in c with struct-s and arrays (or pointers). to simbolize the working principe Gary Herron je napisao/la: Dongsheng Ruan wrote: with a cell class like this: #!/usr/bin/python import sys class Cell: def __init__(

Re: for v in l:

2007-01-16 Thread Gert Cuykens
ok thx this was just what i was looking for http://docs.python.org/tut/node7.html#SECTION00760 -- http://mail.python.org/mailman/listinfo/python-list

OT: teleporters (Was: General Question About Python)

2007-01-16 Thread Carroll, Barry
-Original Message- From: Hendrik van Rooyen [mailto:[EMAIL PROTECTED] Sent: Saturday, January 13, 2007 9:47 PM To: Torabisu; python-list@python.org Subject: Re: General Question About Python Torabisu [EMAIL PROTECTED] wrote: Hendrik van Rooyen wrote: What do you want

Re: Regex Question

2007-01-16 Thread Bill Mill
James Stroud wrote: Bill Mill wrote: Hello all, I've got a test script: start python code = tests2 = [item1: alpha; item2: beta. item3 - gamma--, item1: alpha; item3 - gamma--] def test_re(regex): r = re.compile(regex, re.MULTILINE) for test in tests2:

Re: How to determine what exceptions a method might raise?

2007-01-16 Thread Harlin Seritt
Hi Ed, Generally checking the sources give a very good clue as to what exceptions the interpreter can raise. Look around _builtins_ for this. Harlin Seritt Ed Jensen wrote: I'm really enjoying using the Python interactive interpreter to learn more about the language. It's fantastic you can

  1   2   >