Re: How does one write a function that increments a number?

2005-06-25 Thread George Sakkis
[EMAIL PROTECTED] wrote: Wait... so this means it is impossible to write a function that increments an integer without turning the integer into a list? The short answer is no you can't, because integers are immutable (as well as floats and strings among others). The longer answer is you can

Re: How does one write a function that increments a number?

2005-06-25 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 25/06/2005 01:41: Wait... so this means it is impossible to write a function that increments an integer without turning the integer into a list? Well, one of these options will probably suit: def increment_counter(data): ... data += 1 ...

Re: How does one write a function that increments a number?

2005-06-25 Thread Steven Bethard
[EMAIL PROTECTED] wrote: Apologies if this question seems stupid: How does one write a function that increments a value in Python? When I tried, the variable never changed. The session went like this: def incr(counter): counter = int(counter) counter += 1 counter = 1

Re: How does one write a function that increments a number?

2005-06-25 Thread [EMAIL PROTECTED]
Thank you all for your helpful replies. Regards, Vaibhav -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-06-25 Thread William Heymann
On Friday 24 June 2005 02:53 pm, D H wrote: Again, you are splitting hairs. His point still stands that it is not possible to do method overloading in python (unless you use decorator hacks). It may be possible to add this feature when type declarations and type checking are added to a

Re: A tool for Python - request for some advice

2005-06-25 Thread Terry Hancock
On Friday 24 June 2005 04:04 am, TPJ wrote: If your target platform is Linux, indications are that python is as portable as bash. I've thought about it for a few days and I disagree with you. Python isn't as portable as bash because of one reason. The problem is that development of Python

Îʸö¹ØÓÚemuleµÄÎÊÌâ

2005-06-25 Thread Denton
近日找个东西,最后在emule上找到了,还只有一个源 排队等了半天也没轮到.,最后找了个坛子去求档了 平日很少用emule 想问问emule排队和积分的关系 是不是积分是一对一的,并不是按自己总的上传下载量来计算的? 如果对方不从我这里下载东西,我只能通过排队时间来提高自己的积分? 我给其他人的上传量无法改变我在对方的积分�? -- http://mail.python.org/mailman/listinfo/python-list

Re: a dictionary from a list

2005-06-25 Thread Terry Hancock
On Friday 24 June 2005 05:26 pm, infidel wrote: dict((x, None) for x in alist) or if you want it to run in 2.3 (before generator expressions): dict( [(x,None) for x in alist] ) Before the dict constructor, you needed to do this: d={} for key in alist: d[key]=None which is still only 3

Re: 问个关于emule的问题

2005-06-25 Thread limodou
This is a Englist maillist, you should better use English. And your question is not about Python, you should ask it in emule maillist. 在 05-6-25,Denton[EMAIL PROTECTED] 写道: 近日找个东西,最后在emule上找到了,还只有一个源 排队等了半天也没轮到.,最后找了个坛子去求档了 平日很少用emule 想问问emule排队和积分的关系 是不是积分是一对一的,并不是按自己总的上传下载量来计算的?

Re: windows service problem

2005-06-25 Thread Konstantin Veretennicov
On 6/24/05, Austin [EMAIL PROTECTED] wrote: def __init__(self,args): win32serviceutil.ServiceFramework.__init__(self,args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) self.check = 1 Change last two lines to self.check = 1 self.hWaitStop =

Excellent Site for Developers

2005-06-25 Thread vb_dev2005
Excellent Site for Developers - you can ask any Question in VB6 or VB.NET - you can download the best VB Books - you can download ActiveX - you can visit the most powerfull VB sites http://www.mox-hosting.com/vbdevs/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Tracing down segfault

2005-06-25 Thread Stephen Kellett
In message [EMAIL PROTECTED], Tony Meyer [EMAIL PROTECTED] writes I have (unfortunately) a Python program that I can consistently (in a reproducible way) segfault. However, I've got somewhat used to Python's very nice habit of protecting me from segfaults and raising exceptions instead, and am

Re: Running Python scripts under W2K with I/O redirection

2005-06-25 Thread vincent wehren
[EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] |I apologise if this is a well known problem. I've searched and can't | find a clear description or fix. Hope someone can help. | | I am running my Python scripts under Windows 2000 using Python 2.4 | Build 243 from Activestate. | |

Background thread

2005-06-25 Thread Jorge Louis De Castro
Hi, I'm new to python and I'm having trouble figuring out a way to have a thread running on the background thatover rulesthe raw_input function. The example I'm working on is something like having a thread that prints "You're taking too long" every 10 seconds, while waiting for input from

Re: Office COM automatisation - calling python from VBA

2005-06-25 Thread Konstantin Veretennicov
On 6/25/05, Stephen Prinster [EMAIL PROTECTED] wrote: guy lateur wrote: If you are new to Python and want to use it with COM, definitely get yourself a copy of _Python Programming on Win32_ by Mark Hammond and Andy Robinson. ...or at least read the chapter available online:

Re: Favorite non-python language trick?

2005-06-25 Thread Mandus
Fri, 24 Jun 2005 16:31:08 +0100 skrev Tom Anderson: On Fri, 24 Jun 2005, Joseph Garvin wrote: Claudio Grondi wrote: So far we've got lisp macros and a thousand response's to the lua trick. Anyone else have any actual non-python language tricks they like? Higher-order functions like map,

Re: Office COM automatisation - calling python from VBA

2005-06-25 Thread Josef Meile
Hi guy, I'll be using COM, and I could probably make an application that controls Outlook (externally). But I'd also like to have this functionality exposed in OL itself. So I guess I'll need to use VBA, but I don't really like VBA - relax, please, it's just an opinion.. ;) So, ideally,

Re: Favorite non-python language trick?

2005-06-25 Thread Robert Kern
Mandus wrote: Fri, 24 Jun 2005 16:31:08 +0100 skrev Tom Anderson: Higher-order functions like map, filter and reduce. As of Python 3000, they're non-python tricks. Sigh - i guess it's time for me to get to know list comprehensions a bit better. u-huu... I wasn't aware of that. It is really

Life of Python

2005-06-25 Thread Uwe Mayer
Hi, I have come across the following statement a number of times: http://mail.python.org/pipermail/python-list/2003-July/171805.html [... how to enforce pure abstract class ...] Python, in general, doesn't try to stop the programmer doing things, the way many other languages do. This is known

Re: Background thread

2005-06-25 Thread Jp Calderone
On Sat, 25 Jun 2005 11:36:57 +0100, Jorge Louis De Castro [EMAIL PROTECTED] wrote: Hi, I'm new to python and I'm having trouble figuring out a way to have a thread running on the background that over rules the raw_input function. The example I'm working on is something like having a thread

super problem

2005-06-25 Thread Uwe Mayer
Hi, I have a diamond-shaped multiple inheritanc chain with new style classes, but super() does not call the parent class correctly: -- snip -- from qtcanvas import * class B2(QCanvasItem): def move(self, x,y): super(B2, self).move(0,0) print B2 class C2(QCanvasItem):

execute python code and save the stdout as a string

2005-06-25 Thread jwaixs
Hello, I've a question. Can I execute a part of a python code and put it's output in a string? Something like this: s = s = exec print Hello World print s Greetz, Noud -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Re: Looking For Geodetic Python Software

2005-06-25 Thread Diez B. Roggisch
The article implied that the automated system would allow for /shorter paths/ (the shortest path is the great circle, so this statement indicates that trans-oceanic flights are not using great circle/GPS routing). Most likely, the flights are using 50 minute plumb lines, with a heading

Re: Life of Python

2005-06-25 Thread Benji York
Uwe Mayer wrote: con: If you are planning larger applications (for a reasonable value of large) you have to discipline yourself to write well structured code. This is definitely true, no matter the language you use. Then you will want to specify interfaces, If you're really interested in

Re: a dictionary from a list

2005-06-25 Thread Roy Smith
Terry Hancock [EMAIL PROTECTED] wrote: Before the dict constructor, you needed to do this: d={} for key in alist: d[key]=None I just re-read the documentation on the dict() constructor. Why does it support keyword arguments? dict(foo=bar, baz=blah) == {foo:bar, baz=blah} This

Re: execute python code and save the stdout as a string

2005-06-25 Thread Leif K-Brooks
jwaixs wrote: I've a question. Can I execute a part of a python code and put it's output in a string? import sys from cStringIO import StringIO def exec_and_get_output(code): ... old_stdout = sys.stdout ... sys.stdout = StringIO() ... try: ... exec code in {}, {}

Re: a dictionary from a list

2005-06-25 Thread George Sakkis
Roy Smith [EMAIL PROTECTED] wrote: I just re-read the documentation on the dict() constructor. Why does it support keyword arguments? dict(foo=bar, baz=blah) == {foo:bar, baz=blah} This smacks of creeping featurism. Is this actually useful in real code? It took me several readings of

Re: Favorite non-python language trick?

2005-06-25 Thread Roy Smith
Steve [EMAIL PROTECTED] wrote: One thing that I miss every once in a while is pre-processing. There are so many things wrong with preprocessing, at least if you're thinking of the way C/C++ implements it (cpp). Cpp a number of things. 1) It does file inclusion. Pythons import serves that

Re: Office COM automatisation - calling python from VBA

2005-06-25 Thread Konstantin Veretennicov
On 6/25/05, Josef Meile [EMAIL PROTECTED] wrote: You could try to do an addin/addon for Word, Excel, and Outlook. You don't need to code with VBA. Here you just need a language from where you can access the microsoft interop assemblies (ie: C++ or C#; IronPython maybe?) Hmm... Why jump

Re: a dictionary from a list

2005-06-25 Thread Jp Calderone
On Sat, 25 Jun 2005 09:10:33 -0400, Roy Smith [EMAIL PROTECTED] wrote: Terry Hancock [EMAIL PROTECTED] wrote: Before the dict constructor, you needed to do this: d={} for key in alist: d[key]=None I just re-read the documentation on the dict() constructor. Why does it support keyword

Re: super problem

2005-06-25 Thread Michael Hoffman
Uwe Mayer wrote: I have a diamond-shaped multiple inheritanc chain with new style classes, but super() does not call the parent class correctly: -- snip -- from qtcanvas import * I don't have qtcanvas installed, and I couldn't reproduce the undesirable behavior using a dummy class. If you

Re: a dictionary from a list

2005-06-25 Thread Michael Hoffman
Roy Smith wrote: I just re-read the documentation on the dict() constructor. Why does it support keyword arguments? dict(foo=bar, baz=blah) == {foo:bar, baz=blah} This smacks of creeping featurism. Is this actually useful in real code? Personally, I use it all the time. It's a

Re: Excellent Site for Developers

2005-06-25 Thread Do Re Mi chel La Si Do
rather... super troll -- http://mail.python.org/mailman/listinfo/python-list

Re: Excellent Site for Developers

2005-06-25 Thread Brian
Do Re Mi chel La Si Do wrote: rather... super troll 100% Agreed. Can anyone say, This looks like spam... Feels like spam... and is about as useful here in the Python forums as spam -- therfore my conclusion is that his VB message probably IS SPAM. :-D Brian --- --

regex question

2005-06-25 Thread Felix Schwarz
Hi all, I'm experiencing problems with a regular expression and I can't figure out which words I use when googling. I read the python documentation for the re module multiple times now but still no idea what I'm doing wrong. What I want to do: - Extract all digits (\d) in a string. - Digits

Re: super problem

2005-06-25 Thread Konstantin Veretennicov
On 6/25/05, Uwe Mayer [EMAIL PROTECTED] wrote: AFAIK super only works with new-style classes, so I checked: from qtcanvas import * isinstance(QCanvasItem, object) True AFAIK, this is not the right way to check for new-styledness: class X: i'm an old-styler isinstance(X(), object) True

Re: regex question

2005-06-25 Thread Helmut Jarausch
Felix Schwarz wrote: Hi all, I'm experiencing problems with a regular expression and I can't figure out which words I use when googling. I read the python documentation for the re module multiple times now but still no idea what I'm doing wrong. What I want to do: - Extract all digits

BaseHTTPServer and priviledge separation?

2005-06-25 Thread Helmut Jarausch
Hi, to use a port below 1000 on a Unix system one needs root priviledges. But it's dangerous to execute all of a script under those priviledges. Therefore I'd like to drop the root priviledges as soon as possible. (How) is this possible? Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer

Re: Favorite non-python language trick?

2005-06-25 Thread Konstantin Veretennicov
On 6/25/05, Mandus [EMAIL PROTECTED] wrote: It is really a consensus on this; that removing map, filter, reduce is a good thing? It will render a whole lot of my software unusable :( I think you'll be able to use from __past__ import map, filter, reduce or something like that :) They don't

Re: BaseHTTPServer and priviledge separation?

2005-06-25 Thread Lee Harr
to use a port below 1000 on a Unix system one needs root priviledges. But it's dangerous to execute all of a script under those priviledges. Therefore I'd like to drop the root priviledges as soon as possible. (How) is this possible? Are you sure you don't just want to use twisted?

Re: Favorite non-python language trick?

2005-06-25 Thread Lee Harr
Higher-order functions like map, filter and reduce. As of Python 3000, they're non-python tricks. Sigh - i guess it's time for me to get to know list comprehensions a bit better. Couldnt there just be a functional module ?... from functional import map, filter, reduce --

Re: a dictionary from a list

2005-06-25 Thread Scott David Daniels
Roy Smith wrote: Terry Hancock [EMAIL PROTECTED] wrote: ... I just re-read the documentation on the dict() constructor. Why does it support keyword arguments? dict(foo=bar, baz=blah) == {foo:bar, baz=blah} This smacks of creeping featurism. Is this actually useful in real code? Yes

distutils: Every file doubled in binary distri

2005-06-25 Thread Torsten Bronger
Hallöchen! I have a very simple package structure with one directory denoting a package (with __init__.py file of course). In my setup.py I write ... packages=['my_package'] ... Then I call python setup.py bdist_dumb on ym Linux box. The resulting tar ball contains every file

Re: what list comprehension can't

2005-06-25 Thread Steven D'Aprano
On Fri, 24 Jun 2005 21:04:15 +0200, Christophe Delord wrote: Hello, On 24 Jun 2005 11:45:14 -0700, [EMAIL PROTECTED] wrote: Hello, Can we impose if then else into list comprehension ? Like we do in lambda-map form: This code change None into 0 L = [None, 12] R = map(lambda x:

Re: Excellent Site for Developers

2005-06-25 Thread Charles Krug
On Sat, 25 Jun 2005 14:50:48 GMT, Brian [EMAIL PROTECTED] wrote: Do Re Mi chel La Si Do wrote: rather... super troll 100% Agreed. Can anyone say, This looks like spam... Feels like spam... and is about as useful here in the Python forums as spam -- therfore my conclusion is that

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Fri, 24 Jun 2005 14:29:37 -0700, James wrote: Interesting thread ... 1.) Language support for ranges as in Ada/Pascal/Ruby 1..10 rather than range(1, 10) What advantages do Pascal-like for loops give over Python for loops? The only two I can think of are trivial: (1) the Pascal-like

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Fri, 24 Jun 2005 15:47:45 -0700, James Stroud wrote: On Friday 24 June 2005 05:58 am, Steven D'Aprano wrote: with colour do begin red := 0; blue := 255; green := 0; end; instead of: colour.red := 0; colour.blue := 255; colour.green := 0; Okay, so maybe it is more of a feature than a

Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
Hi, I'm getting pretty desperate here: The code below crashes on the last line (but works from a shell). The class 'BC' exists and the loop on self.__BC_EXEC_LIST passes fine. It's got to be something really stupid but I've been looking at it too long I guess. Any clue would be quite welcome.

Re: How does one write a function that increments a number?

2005-06-25 Thread Steven D'Aprano
On Fri, 24 Jun 2005 21:53:03 -0700, [EMAIL PROTECTED] wrote: Apologies if this question seems stupid: How does one write a function that increments a value in Python? When I tried, the variable never changed. The session went like this: def incr(counter): counter = int(counter)

Re: distutils: Every file doubled in binary distri

2005-06-25 Thread Torsten Bronger
Hallöchen! Ingrid Bronger [EMAIL PROTECTED] writes: [...] Then I call python setup.py bdist_dumb on ym Linux box. The resulting tar ball contains every file twice, e.g. ./usr/lib/python2.3/site-packages/my_package/my_module.py ./usr/lib/python2.3/site-packages/my_module.py Why is this?

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
Hi, Hopefully to make things clearer: this works from a shell: In [23]:from SC.CARDS.BC import * In [24]:l = inspect.getmembers(eval('BC')) #l will get all members from class 'BC' whereas the code referenced below gets an exception saying 'BC' is not defined. Thanks, Philippe Philippe C.

Re: Favorite non-python language trick?

2005-06-25 Thread Konstantin Veretennicov
On 6/25/05, Steven D'Aprano [EMAIL PROTECTED] wrote: On Fri, 24 Jun 2005 14:29:37 -0700, James wrote: 2.) Contracts Explain please. James probably meant Eiffel's Design by Contract. My favourite Python implementation is Terence Way's http://www.wayforward.net/pycontract/ ;-) - kv --

Re: a dictionary from a list

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 06:44:22 -0700, George Sakkis wrote: Roy Smith [EMAIL PROTECTED] wrote: I just re-read the documentation on the dict() constructor. Why does it support keyword arguments? dict(foo=bar, baz=blah) == {foo:bar, baz=blah} This smacks of creeping featurism. Is this

Re: regex question

2005-06-25 Thread George Sakkis
Felix Schwarz [EMAIL PROTECTED] wrote: Hi all, I'm experiencing problems with a regular expression and I can't figure out which words I use when googling. I read the python documentation for the re module multiple times now but still no idea what I'm doing wrong. What I want to do: -

Re: regex question

2005-06-25 Thread Paul McGuire
Here's a pyparsing version of this, that may be easier to maintain long term (although if you have your heart set on learning regexp's, they will certainly do the job). Note that in pyparsing, you don't have to spell out where the whitespace goes - pyparsing's default logic assumes that

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 17:41:58 +0200, Konstantin Veretennicov wrote: On 6/25/05, Mandus [EMAIL PROTECTED] wrote: It is really a consensus on this; that removing map, filter, reduce is a good thing? It will render a whole lot of my software unusable :( I think you'll be able to use from

Re: a dictionary from a list

2005-06-25 Thread George Sakkis
Steven D'Aprano wrote: On Sat, 25 Jun 2005 06:44:22 -0700, George Sakkis wrote: Roy Smith [EMAIL PROTECTED] wrote: I just re-read the documentation on the dict() constructor. Why does it support keyword arguments? dict(foo=bar, baz=blah) == {foo:bar, baz=blah} This smacks of

Re: Favorite non-python language trick?

2005-06-25 Thread Konstantin Veretennicov
On 6/25/05, Steven D'Aprano [EMAIL PROTECTED] wrote: On Sat, 25 Jun 2005 17:41:58 +0200, Konstantin Veretennicov wrote: On 6/25/05, Mandus [EMAIL PROTECTED] wrote: It is really a consensus on this; that removing map, filter, reduce is a good thing? It will render a whole lot of my

Re: Favorite non-python language trick?

2005-06-25 Thread Tom Anderson
On Fri, 24 Jun 2005, Roy Smith wrote: Tom Anderson [EMAIL PROTECTED] wrote: The one thing i really do miss is method overloading by parameter type. I used this all the time in java You do things like that in type-bondage languages I love that expression. I think it started out as

Re: Favorite non-python language trick?

2005-06-25 Thread Tom Anderson
On Sat, 25 Jun 2005, Konstantin Veretennicov wrote: On 6/25/05, Mandus [EMAIL PROTECTED] wrote: It is really a consensus on this; that removing map, filter, reduce is a good thing? It will render a whole lot of my software unusable :( I think you'll be able to use from __past__ import map,

Re: Favorite non-python language trick?

2005-06-25 Thread George Sakkis
Konstantin Veretennicov [EMAIL PROTECTED] wrote: On 6/25/05, Steven D'Aprano [EMAIL PROTECTED] wrote: On Sat, 25 Jun 2005 17:41:58 +0200, Konstantin Veretennicov wrote: On 6/25/05, Mandus [EMAIL PROTECTED] wrote: It is really a consensus on this; that removing map, filter, reduce is

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
Hi, I found the solution to my problem: Besides the fact I still have no clue as to how the Python name spacing works, the code I though did stuff (the __EXEC_LIST loop) did not do as I expected as I had already imported all of the modules in an explicit manner. So now I can rephrase my

Re: Favorite non-python language trick?

2005-06-25 Thread Mandus
Sun, 26 Jun 2005 04:36:51 +1000 skrev Steven D'Aprano: On Sat, 25 Jun 2005 17:41:58 +0200, Konstantin Veretennicov wrote: On 6/25/05, Mandus [EMAIL PROTECTED] wrote: It is really a consensus on this; that removing map, filter, reduce is a good thing? It will render a whole lot of my software

Re: Excellent Site for Developers

2005-06-25 Thread Brian van den Broek
Brian said unto the world upon 25/06/2005 10:50: Do Re Mi chel La Si Do wrote: rather... super troll 100% Agreed. Can anyone say, This looks like spam... Feels like spam... and is about as useful here in the Python forums as spam -- therfore my conclusion is that his VB message

Re: Favorite non-python language trick?

2005-06-25 Thread Mandus
Sat, 25 Jun 2005 16:06:57 GMT skrev Lee Harr: Higher-order functions like map, filter and reduce. As of Python 3000, they're non-python tricks. Sigh - i guess it's time for me to get to know list comprehensions a bit better. Couldnt there just be a functional module ?... from functional

Re: Favorite non-python language trick?

2005-06-25 Thread Devan L
Why overload when you can use class methods? -- http://mail.python.org/mailman/listinfo/python-list

Re: How does one write a function that increments a number?

2005-06-25 Thread Mandus
Sun, 26 Jun 2005 04:14:19 +1000 skrev Steven D'Aprano: On Fri, 24 Jun 2005 21:53:03 -0700, [EMAIL PROTECTED] wrote: Apologies if this question seems stupid: How does one write a function that increments a value in Python? When I tried, the variable never changed. The session went like

Re: Favorite non-python language trick?

2005-06-25 Thread Peter Otten
Mandus wrote: By using the builtin reduce, I move the for-loop into the c-code which performs better. No. There is no hope of ever writing fast code when you do not actually measure its performance. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Excellent Site for Developers

2005-06-25 Thread Philippe C. Martin
Hi, Not being from anglo-saxon heritage, I keep wondering why spammers always (or very often) get called 'trolls' ? I mean fantasy fiction has brought us many hugly beasts (goblin, warlock, orc, dark elf ) The trolls, as I recall, grow back their limns once those have been cut by the nice

Re: Excellent Site for Developers

2005-06-25 Thread Philippe C. Martin
Sorry, limbs (plus I check in a dictionnary first!) Philippe C. Martin wrote: limns -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-06-25 Thread Nicolas Fleury
Steven D'Aprano wrote: One of the things I liked in Pascal was the with keyword. You could write something like this: with colour do begin red := 0; blue := 255; green := 0; end; instead of: colour.red := 0; colour.blue := 255; colour.green := 0; Okay, so maybe it is more of a

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
OK Peter, first of all thanks. You seem to be German and although I leave in the states, I'm French and your english is clearly far more advanced than mine: I have yet to understand a few of your comments ;-) Care to provide the traceback? Traceback (most recent call last): File SC_Shell.py,

Re: Favorite non-python language trick?

2005-06-25 Thread Mandus
Sat, 25 Jun 2005 21:30:26 +0200 skrev Peter Otten: Mandus wrote: By using the builtin reduce, I move the for-loop into the c-code which performs better. No. There is no hope of ever writing fast code when you do not actually measure its performance. I do. -- Mandus - the only mandus

Re: Excellent Site for Developers

2005-06-25 Thread Philippe C. Martin
Woof! And I thought my english was improving ! I'm laughing very hard right now, thanks ! Philippe Skip Montanaro wrote: Philippe Not being from anglo-saxon heritage, I keep wondering why Philippe spammers always (or very often) get called 'trolls' ? Fishing from a boat that

Re: Favorite non-python language trick?

2005-06-25 Thread Mandus
25 Jun 2005 13:15:16 -0700 skrev Devan L: But by using the builtin reduce, you need to specify a function, which probably slows it down more than any speed-up from the loop in C. Sounds reasonable, but not always the case, especially when dealing with numpy arrays. At least that what some of my

Re: Favorite non-python language trick?

2005-06-25 Thread Robert Kern
Devan L wrote: But by using the builtin reduce, you need to specify a function, which probably slows it down more than any speed-up from the loop in C. Not if the function is from an extension module. For some applications, this can be quite common. Of course, in a Python 3000 world, nothing

Re: Excellent Site for Developers

2005-06-25 Thread Chinook
On Sat, 25 Jun 2005 15:36:06 -0400, Philippe C. Martin wrote (in article [EMAIL PROTECTED]): Hi, Not being from anglo-saxon heritage, I keep wondering why spammers always (or very often) get called 'trolls' ? I mean fantasy fiction has brought us many hugly beasts (goblin, warlock, orc,

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Peter Otten
Philippe C. Martin wrote: OK Peter, first of all thanks. You seem to be German and although I leave in the states, I'm French and your english is clearly far more advanced than mine: I have yet to understand a few of your comments ;-) My French is mostly read-only, so let me rephrase:

Re: Office COM automatisation - calling python from VBA

2005-06-25 Thread Johan Lindberg
Hi. If you are new to Python and want to use it with COM, definitely get yourself a copy of _Python Programming on Win32_ by Mark Hammond and Andy Robinson. ...or at least read the chapter available online: http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html Also, check out the

A strange and annoying restriction, possibly a bug. A glance by a more experienced would be nice.

2005-06-25 Thread Elmo Mäntynen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This is the case: n=(100,) tuple(*n) Traceback (most recent call last): File pyshell#31, line 1, in -toplevel- tuple(*n) TypeError: iteration over non-sequence To be sure I searched for ways to check if something is a sequence:

Re: A strange and annoying restriction, possibly a bug. A glance by a more experienced would be nice.

2005-06-25 Thread Robert Kern
Elmo Mäntynen wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This is the case: n=(100,) tuple(*n) Traceback (most recent call last): File pyshell#31, line 1, in -toplevel- tuple(*n) TypeError: iteration over non-sequence n is a sequence. *n correctly expands. The

Re: A strange and annoying restriction, possibly a bug. A glance by a more experienced would be nice.

2005-06-25 Thread D H
Elmo Mäntynen wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This is the case: n=(100,) tuple(*n) Traceback (most recent call last): File pyshell#31, line 1, in -toplevel- tuple(*n) TypeError: iteration over non-sequence The star (*n) means you are essentially calling

python-dev Summary for 2005-05-01 through 2005-05-15

2005-06-25 Thread Steven Bethard
[The HTML version of this Summary is available at http://www.python.org/dev/summary/2005-05-01_2005-05-15.html] = Summary Announcements = -- PEP 340 Episode 2: Revenge of the With (Block)

python-dev Summary for 2005-05-16 through 2005-05-31

2005-06-25 Thread Steven Bethard
[The HTML version of this Summary is available at http://www.python.org/dev/summary/2005-05-16_2005-05-31.html] = Summary Announcements = QOTF We have our first ever Quote of the Fortnight (QOTF), thanks to the wave of discussion over `PEP 343`_

python-dev Summary for 2005-06-01 through 2005-06-15

2005-06-25 Thread Steven Bethard
[The HTML version of this Summary is available at http://www.python.org/dev/summary/2005-06-01_2005-06-15.html] = Summary Announcements = - Bug Day: Saturday, June 25th 2005 - AMK organized

Re: Favorite non-python language trick?

2005-06-25 Thread Bengt Richter
On Sun, 26 Jun 2005 04:08:31 +1000, Steven D'Aprano [EMAIL PROTECTED] wrote: On Fri, 24 Jun 2005 15:47:45 -0700, James Stroud wrote: On Friday 24 June 2005 05:58 am, Steven D'Aprano wrote: with colour do begin red := 0; blue := 255; green := 0; end; instead of: colour.red := 0;

Thoughts on Guido's ITC audio interview

2005-06-25 Thread Dave Benjamin
Guido gave a good, long interview, available at IT Conversations, as was recently announced by Dr. Dobb's Python-URL! The audio clips are available here: http://www.itconversations.com/shows/detail545.html http://www.itconversations.com/shows/detail559.html I'd like to comment on a few parts of

Re: trouble subclassing str

2005-06-25 Thread Bengt Richter
On 23 Jun 2005 21:27:20 -0700, Paul McGuire [EMAIL PROTECTED] wrote: Dang, that class should be: class PaddedStr(str): def __new__(cls,s,l,padc=' '): if l len(s): s2 = %s%s % (s,padc*(l-len(s))) return str.__new__(cls,s2) else: return

Re: A strange and annoying restriction, possibly a bug. A glance by amore experienced would be nice.

2005-06-25 Thread Terry Reedy
Elmo Mäntynen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] n=(100,) tuple(*n) As posted, this gives a syntax error. What is missing? tjr -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 19:23:18 +, Mandus wrote: Sat, 25 Jun 2005 16:06:57 GMT skrev Lee Harr: Higher-order functions like map, filter and reduce. As of Python 3000, they're non-python tricks. Sigh - i guess it's time for me to get to know list comprehensions a bit better. Couldnt

Re: Favorite non-python language trick?

2005-06-25 Thread Terry Reedy
Mandus [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Fri, 24 Jun 2005 16:31:08 +0100 skrev Tom Anderson: On Fri, 24 Jun 2005, Joseph Garvin wrote: Higher-order functions like map, filter and reduce. As of Python 3000, they're non-python tricks. Sigh - i guess it's time for me to

Re: Thoughts on Guido's ITC audio interview

2005-06-25 Thread John Roth
Dave Benjamin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Guido gave a good, long interview, available at IT Conversations, as was recently announced by Dr. Dobb's Python-URL! The audio clips are available [snip] - Java: the usual static vs. dynamic, static analysis vs. unit

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 15:44:14 -0400, Nicolas Fleury wrote: Steven D'Aprano wrote: One of the things I liked in Pascal was the with keyword. You could write something like this: with colour do begin red := 0; blue := 255; green := 0; end; instead of: colour.red := 0; colour.blue :=

Re: A strange and annoying restriction, possibly a bug. A glance by amore experienced would be nice.

2005-06-25 Thread Terry Reedy
Terry Reedy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Elmo Mäntynen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] n=(100,) tuple(*n) As posted, this gives a syntax error. What is missing? Actually, I should have said 'as received'. --

Re: Favorite non-python language trick?

2005-06-25 Thread James Stroud
On Saturday 25 June 2005 11:08 am, Steven D'Aprano wrote: The problem is, you have made colour (returning to English spelling instead of foreign) into a class. If you need two colour variables, you have to duplicate the code for the class (perhaps only changing the numeric constants. You

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 21:30:26 +0200, Peter Otten wrote: Mandus wrote: By using the builtin reduce, I move the for-loop into the c-code which performs better. No. There is no hope of ever writing fast code when you do not actually measure its performance. Good grief! You've been spying

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 13:31:19 -0700, Robert Kern wrote: Of course, in a Python 3000 world, nothing stops anyone from using their own extension module implementing map, filter, and reduce if they really want to. TSBOOOWTDI in the language/stdlib, but it shouldn't stop anyone from using other

Re: Favorite non-python language trick?

2005-06-25 Thread James Stroud
On Saturday 25 June 2005 06:44 pm, James Stroud wrote: I thought they were pointless 18 years ago when I learned pascal in highschool and after 20 years, I still think they are still pointless. I think that fails ==. -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 18:44:12 -0700, James Stroud wrote: On Saturday 25 June 2005 11:08 am, Steven D'Aprano wrote: The problem is, you have made colour (returning to English spelling instead of foreign) into a class. If you need two colour variables, you have to duplicate the code for the

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 23:08:10 +, Bengt Richter wrote: On Sun, 26 Jun 2005 04:08:31 +1000, Steven D'Aprano [EMAIL PROTECTED] wrote: On Fri, 24 Jun 2005 15:47:45 -0700, James Stroud wrote: On Friday 24 June 2005 05:58 am, Steven D'Aprano wrote: with colour do begin red := 0; blue := 255;

  1   2   >